/* ------------------------------------------------------------------
   WRAPPER PRINCIPAL
------------------------------------------------------------------ */
#mi-wrapper {
    display: flex;
    gap: 45px;
    font-family: 'Inter', sans-serif;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
}

/* ------------------------------------------------------------------
   SIDEBAR
------------------------------------------------------------------ */
#mi-sidebar {
    width: 240px;
    min-width: 240px;
    padding-top: 10px;
    border-right: 1px solid #e5e5e5;
    position: relative;
    box-sizing: border-box;
}

.mi-country-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mi-country-item {
    margin: 0;
    padding: 0;
}

.mi-country-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 12px 18px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.35;
    color: #333;
    text-decoration: none;
    position: relative;
    transition: all 0.25s ease;
}

.mi-country-link:hover {
    background: rgba(0,0,0,0.05);
    color: #072070;
}

.mi-country-link.active {
    background: rgba(0,0,0,0.07);
    color: #072070 !important;
    font-weight: 600;
}

.mi-country-link::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 0;
    width: 4px;
    height: 100%;
    background: #072070;
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transform: translateX(-6px);
    transition: all 0.25s ease;
}

.mi-country-link.active::before {
    opacity: 1;
    transform: translateX(0);
}

.mi-country-link__flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    flex: 0 0 auto;
}

.mi-country-link__icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    flex: 0 0 auto;
}

.mi-country-link__label {
    min-width: 0;
}

/* ------------------------------------------------------------------
   CONTEÚDO PRINCIPAL
------------------------------------------------------------------ */
#mi-content {
    flex: 1 1 auto;
    min-width: 0;
}

#mi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

#mi-country-title {
    margin: 0;
    font-size: clamp(24px, 2vw, 26px);
    line-height: 1.15;
    color: #072070;
    font-weight: 600;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

#mi-country-count {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    flex: 0 0 auto;
    padding-top: 5px;
}

/* ------------------------------------------------------------------
   GRID DE RESULTADOS
------------------------------------------------------------------ */
.mi-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 26px;
    width: 100%;
}

.mi-empty-state {
    text-align: center;
    padding: 50px;
}

.mi-loading-state,
.mi-error-state {
    text-align: center;
    padding: 50px;
}

.mi-loading-state {
    font-style: italic;
}

.mi-error-state {
    color: #b42318;
}

/* ------------------------------------------------------------------
   CARD
------------------------------------------------------------------ */
.mi-university-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    min-height: 240px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    font-family: 'Inter', sans-serif;
    width: 100%;
}

.mi-university-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(7, 32, 112, 0.0) 0%,
        rgba(7, 32, 112, 0.02) 42%,
        rgba(7, 32, 112, 0.48) 100%
    );
    z-index: 1;
}

.mi-university-card__content {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 22px 62px 22px 20px;
    color: #fff;
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
}

.mi-university-card__title {
    margin: 0;
    font-size: clamp(18px, 2vw, 21px);
    line-height: 1.22;
    font-weight: 600;
    min-width: 0;

    /* importante para evitar quebrar em poucas letras por linha */
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    max-width: 100%;
    text-wrap: balance;
}

.mi-university-card__title-link {
    color: #fff;
    text-decoration: none;
    display: inline;
    text-shadow: -1px -1px 1px rgba(255,255,255,0.7), 1px 1px 1px rgba(0,0,0,0.8);
}

.mi-university-card__area {
    font-size: 14px;
    line-height: 1.35;
    opacity: 0.95;
    margin-top: 7px;
    max-width: 100%;
    word-break: normal;
    overflow-wrap: break-word;
}

.mi-university-card__cta {
    position: absolute;
    right: 15px;
    bottom: 15px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    text-decoration: none;
    color: #fff;
}

.mi-university-card__cta span {
    color: #fff;
    font-size: 18px;
    line-height: 1;
}

/* ------------------------------------------------------------------
   PAGINAÇÃO
------------------------------------------------------------------ */
.mi-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 36px;
    width: 100%;
}

.mi-pagination__pages {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
}

.mi-pagination__link {
    min-width: 40px;
    height: 40px;
    padding: 0 13px;
    border: 1px solid rgba(7, 32, 112, 0.18);
    border-radius: 999px;
    background: #fff;
    color: #072070;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mi-pagination__number {
    width: 40px;
    padding: 0;
}

.mi-pagination__link:hover,
.mi-pagination__link:focus-visible {
    border-color: #0587bf;
    background: rgba(5, 135, 191, 0.08);
    color: #072070;
    transform: translateY(-1px);
}

.mi-pagination__link.is-current {
    border-color: #072070;
    background: #072070;
    color: #fff;
    pointer-events: none;
}

.mi-pagination__link.is-disabled {
    opacity: 0.42;
    pointer-events: none;
}

.mi-pagination__ellipsis {
    min-width: 20px;
    color: #6b7280;
    text-align: center;
}

.mi-pagination__status {
    flex-basis: 100%;
    margin-top: 2px;
    color: #666;
    font-size: 13px;
    text-align: center;
}

/* ------------------------------------------------------------------
   TABLET
------------------------------------------------------------------ */
@media (max-width: 1024px) {
    #mi-wrapper {
        gap: 28px;
    }

    #mi-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .mi-results-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 22px;
    }

    .mi-university-card {
        min-height: 220px;
    }

    .mi-university-card__content {
        padding: 20px 58px 20px 18px;
    }
}

/* ------------------------------------------------------------------
   MOBILE / TABLET PEQUENO
------------------------------------------------------------------ */
@media (max-width: 860px) {
    #mi-wrapper {
        flex-direction: column;
        gap: 24px;
    }

    #mi-sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        padding-top: 0;
        padding-bottom: 14px;
    }

    .mi-country-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }

    .mi-country-item {
        flex: 0 0 auto;
    }

    .mi-country-link {
        padding: 10px 14px;
        white-space: nowrap;
        border: 1px solid rgba(0,0,0,0.08);
        background: #fff;
    }

    .mi-country-link::before {
        display: none;
    }

    #mi-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #mi-country-count {
        white-space: normal;
        padding-top: 0;
    }

    .mi-results-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 18px;
    }
}

/* ------------------------------------------------------------------
   MOBILE
------------------------------------------------------------------ */
@media (max-width: 640px) {
    #mi-country-title {
        font-size: 22px;
        line-height: 1.18;
        max-width: 100%;
    }

    .mi-results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .mi-university-card {
        min-height: 220px;
    }

    .mi-university-card__content {
        padding: 18px 56px 18px 16px;
    }

    .mi-university-card__title {
        font-size: 19px;
        line-height: 1.25;

        /* evita o efeito de coluna estreita demais no título */
        max-width: 100%;
    }

    .mi-university-card__area {
        font-size: 13px;
    }

    .mi-pagination {
        gap: 8px;
        margin-top: 28px;
    }

    .mi-pagination__link {
        min-width: 38px;
        height: 38px;
        padding: 0 11px;
        font-size: 13px;
    }

    .mi-pagination__number {
        width: 38px;
        padding: 0;
    }

    .mi-university-card__cta {
        width: 36px;
        height: 36px;
        right: 12px;
        bottom: 12px;
    }
}

/* ------------------------------------------------------------------
   MOBILE MUITO PEQUENO
------------------------------------------------------------------ */
@media (max-width: 420px) {
    #mi-country-title {
        font-size: 20px;
    }

    .mi-country-link {
        font-size: 14px;
    }

    .mi-university-card {
        min-height: 205px;
    }

    .mi-university-card__content {
        padding: 16px 52px 16px 14px;
    }

    .mi-university-card__title {
        font-size: 18px;
        line-height: 1.24;
    }
}
