/* ===== PRE-CONFIGURACOES BASE DO SITE ===== */
:root {
    /* --- Cores do Layout --- */
    --cor-principal: #1F3748;
    --cor-cinza: #D9D9D9;
    --cor-preto: #000000;
    --cor-branco: #FFFFFF;
    --cor-bordas: #DDDDDD;
    --cor-background: #F5F5F5;
    --cor-texto-escuro: #555555;

    /* --- Escala Tipográfica (Hierarquia) --- */
    /* 1rem = 16px (padrão) */
    --fs-h1: 2.5rem;   /* 40px - Título principal */
    --fs-h2: 2rem;     /* 32px - Subtítulos de seção */
    --fs-h3: 1.75rem;  /* 28px - Títulos de blocos/cards */
    --fs-h4: 1.20rem;   /* 24px - Títulos menores/ênfase */
    --fs-body: 1rem;   /* 16px - Texto comum */

    /* Altura fluida: */
    --header-height: clamp(130px, 30vh, 170px);
}

/* ===== CONFIGURACOES GERAIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

html {
    scroll-behavior: smooth;
}

/* ===== HEADER ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--cor-principal);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* ===== TOP HEADER PARA LINGUAS DO SITE ===== */
.topHeader {
    display: flex;
    align-items: center;
    justify-content: right;
    padding: 5px;
    background-color: var(--cor-preto);
}

.languages {
    color: var(--cor-branco);
}

.languages > p {
    font-size: 0.8rem;
}

/* Botões de bandeira de idioma */
.languages {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flagBtn {
    background: none;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    line-height: 0;
}

.flagBtn:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.flagBtn.ativo {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.flag-svg {
    width: 25px;
    height: 25px;
    display: block;
    border-radius: 2px;
}

/* ===== TITULO PRINCIPAL ===== */
.headerTitle {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 5px;
    color: var(--cor-branco);
}

.headerTitle h1 {
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
    padding-left: 15px;
    line-height: 1.3;
}

/* ===== HAMBURGUER ESCONDIDO DO MENU ====== */
.navToggle {
    display: none;
}

/* ===== BARRA DE NAVEGACAO DO SITE ===== */
.navBar{
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    background-color: var(--cor-cinza);
    height: 60px;
    padding: 0;
}

/* Estilização dos itens da barra de navegação*/
.navList{
    display: flex;
    list-style-type: none;
    height: 100%;
    align-items: center;
}

.navList li{
    height: 100%;
    display: flex;
    align-items: center;
    border-right: 2px solid #474747;
    padding: 0 20px;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Estilização dos links de navegação */
.navList li:last-child{
    border-right: none;
    color: var(--cor-preto);
}

.navList li a {
    text-decoration: none; 
    color: inherit;      
}

/* Grifar ao passar ao mouse */
.navList li a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ===== BODY ===== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Garante que o footer fique no fim da tela */
    padding-top: var(--header-height); /* Espaço para o header fixo não cobrir o conteúdo */
    background-color: var(--cor-background);
}

/* Configurações Gerais */
h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--cor-principal);
    font-size: var(--fs-h3);
    position: relative;
    margin-top: 45px;
    margin-bottom: 10px;
}

h3::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: var(--cor-cinza);
}

h4 {
    font-family: 'Montserrat', sans-serif;
    color: var(--cor-texto-escuro);
    font-size: var(--fs-h4);
    margin-top: 20px;
    margin-bottom: 7px;
}

/* Evitar transborde de imagens */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Remover o sublinhado dos links */
a {
    text-decoration: none;
}

a:hover{
    text-decoration: underline;
}

/* Rolagem da tela */
section {
    scroll-margin-top: calc(var(--header-height) + 5px);
}

/* ===== CLASSE RESPONSAVEL PELO MAIN E ASIDE ===== */
.wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
}

/* ===== MAIN ===== */
.main {
    flex: 1 1 0;
    min-width: 0;
    background-color: var(--cor-branco);
    border: 2px solid var(--cor-bordas);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3%;
    min-height: 400px;
    text-align: justify;
}

.main > section {
    width: 100%;
}

.main p {
    line-height: 1.6;
    max-width: 110ch;
}

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s ease,
        transform 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Título principal */
#mainTitle{
    font-family: 'Montserrat', sans-serif;
    font-weight: 250;
    color: var(--cor-principal);
    font-size: var(--fs-h2);
    align-self: flex-start;
    text-align: start;
}

/* Container principal */
#primeiroContato{
    background-color: var(--cor-background);
    border-left: 4px solid var(--cor-principal);
    padding: 25px 35px;
    margin: 20px 0;
    width: 100%;
}

/* Estilizacao paragrafo principal */
#primeiroContato p{
    color: var(--cor-texto-escuro);
    line-height: 1.4;
    font-size: var(--fs-body);
    text-align: justify;
}

/* Imagem Sobre Section */
#sobreImage {
    width: 100%;
    max-width: 400px;
    margin: 24px auto;
    border-radius: 6px;
}

#matrizesImages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 20px auto;
    width: 90%;
}

#matrizesImages img {
    width: 100%;
    height: auto;
}

/* ===== PARTE INTERATIVA DE EMENTAS ===== */

.matriz-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding: 20px 0 60px 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.matriz-wrapper::after {
    content: '';
    display: none;
    position: sticky;
    right: 0;
    top: 0;
    width: 32px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.85));
    pointer-events: none;
}

.grade-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: opacity 0.3s;
}

/* Quando o container tem a classe 'foco', escurece as matérias não selecionadas */
.grade-container.foco .disciplina:not(.destaque) {
    opacity: 0.3;
    transform: scale(0.98);
    filter: grayscale(80%);
}

.periodo {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: start;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 15px;
}

.periodo > span[aria-hidden="true"] {
    display: none;
}

.numero-periodo {
    display: flex;
    align-items: center;
    align-self: center;
    justify-content: center;
    padding-top: 14px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    grid-row: 1;
}

/* Container interno que agrupa as disciplinas e permite o wrap delas */
.disciplinas-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.disciplina {
    flex: 1 1 130px;
    min-width: 110px;
    padding: 12px 8px;
    border-radius: 8px;
    border: 1px solid #aaa;
    text-align: center;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    user-select: none;
    position: relative;
    z-index: 1;
}

.disciplina.destaque {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-color: #333;
}

/* Cores da Legenda Ementas*/
.cor-basico { background-color: #fff9c4; } /* Amarelo claro */
.cor-especifico { background-color: #dcedc8; } /* Verde claro */
.cor-tematica { background-color: #bbdefb; } /* Azul claro */
.cor-estagio { background-color: #e1bee7; } /* Roxo claro */
.cor-complementar { background-color: #ffb74d; font-weight: bold;} /* Laranja */
.cor-nucleo { background-color: #e0e0e0; } /* Cinza */
.cor-avancado { background-color: #81c784; color: #fff;} /* Verde escuro */

.codigo { font-weight: bold; margin-top: 6px; font-size: 0.75rem; color: rgba(0,0,0,0.6); }
.cor-avancado .codigo { color: rgba(255,255,255,0.9); }

.tooltip-content { text-align: left; padding: 5px; font-size: 0.85rem; line-height: 1.4; max-width: 300px;}
.tooltip-content h4 { margin: 0 0 5px 0; color: #1a237e; }
.tooltip-content p { margin: 0; color: #444; }

/* Secões do aide */
.aside{
    display: flex;
    flex: 0 0 360px;
    flex-direction: column;
    gap: 10px;
}

.asideSections{
    background-color: var(--cor-branco);
    padding: 25px;
    border: 2px solid var(--cor-principal);
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    transition: 0.3s;
}

/*Estilização das Secoes do aside */
.asideSections p{
    padding: 15px 0;
    border-bottom: 1px dotted var(--cor-cinza);
    margin-bottom: 0;
}

.asideSections p i{
    display: block;
    color: var(--cor-principal);
    font-family: 'Montserrat', sans-serif;
    font-size: var(--fs-body);
    border-bottom: 2px dotted var(--cor-principal);
    padding-bottom: 5px;
    cursor: pointer;
}

.asideSections p:last-of-type{
    border-bottom: none;
}

.asideSections p i:hover{
    text-decoration: underline;
}

.asideSections h3{
    margin-top: 0;
    font-size: var(--fs-h4);
    border-bottom: 2px solid var(--cor-principal);
    margin-bottom: 10px;
    padding-top: 0;
}

.asideSections h3::after {
    display: none;
}

/* Botoes secao info geral aside 1 */
.botoesInfoGeral {
    width: 100%;
    margin-bottom: 10px;
    padding: 15px;
    text-align: center;
    border: none;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: filter 0.2s;
}

.botoesInfoGeral:hover {
    filter: brightness(1.2);
}

.botoesInfoGeral a{
    text-decoration: none;
    color: inherit;
    display: block;
}

.botoesInfoGeral a:hover{
    text-decoration: none;
}

#botaoIngresso {
    background-color: var(--cor-principal);
    color: white;
}

.SeriadoUFMG {
    background-color: #333333;
    color: white;
}

/* ===== ASIDE TOGGLE ===== */
/* Botão de Toggle (Escondido no Desktop) */
.aside-toggle {
    display: none;
    position: fixed;
    right: 0;
    top: 200px;

    background-color: var(--cor-cinza);
    color: var(--cor-preto);

    padding: 15px 10px;
    border: none;
    border-radius: 0px 10px 10px 0px;

    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);

    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: 0.3s;
}

.aside-toggle:hover {
    background-color: #bcbcbc;
}

/* Footer Responsivo */
.footer {
    background-color: var(--cor-principal);
    color: #BDC3C7;
    padding: 40px 10% 20px 10%;
    font-size: 0.85rem;
}

.footer img {
    max-height: 65px;
    width: auto;
    filter: brightness(1.2);
}

.footer h4 {
    color: var(--cor-branco);
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* Linha sutil sob os títulos */
    text-transform: uppercase;
}

.footerGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footerLogosTop {
    grid-template-columns: 1fr 2fr;
    align-items: start;
}

.footerColumn p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.footerColumnLarge {
    width: 100%;
}

.logoContainer {
    display: flex;
    align-items: center;
    padding-top: 20px;
}

.logoContainer.row {
    gap: 50px;
}

#logoUFMG {
    width: clamp(100px, 12vw, 150px);
    height: auto;
}

#EELogo {
    max-height: 120px;
}

.footerDepartamentos {
    margin-top: 40px;
}

.logoRowFull {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.logoRowFull img {
    height: clamp(28px, 4vw, 60px);
    width: auto;
    max-width: 100%;
    filter: brightness(1.2);
}

#sectionCopyright {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 40px;
    padding-top: 20px;
    font-size: 0.75rem;
}

/* ===== RESPONSIVIDADE MOBILE ===== */

@media (max-width: 900px) {
    /* NavBar: alinha o hamburguer à esquerda */
    .navBar {
        justify-content: flex-start;
    }

    /* Botão hamburguer */
    .navToggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.6rem;
        padding: 0 18px;
        cursor: pointer;
        height: 100%;
        color: var(--cor-preto);
        flex-shrink: 0;
    }

    .navToggle:hover {
        background-color: rgba(0, 0, 0, 0.08);
    }

    /* Menu oculto por padrão */
    .navList {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 260px;
        flex-direction: column;
        background-color: var(--cor-cinza);
        height: auto;
        max-height: calc(100vh - var(--header-height));
        z-index: 999;
        overflow-y: auto;
        box-shadow: 4px 4px 1px rgba(0, 0, 0, 0.2);
    }

    /* Menu visível quando ativo */
    .navList.navAberto {
        display: flex;
    }

    /* Itens do menu mobile */
    .navList li {
        height: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.377);
        padding: 16px 24px;
        font-size: 0.9rem;
    }

    .navList li:last-child {
        border-right: none;
        border-bottom: none;
    }

    .main {
        flex: 1 1 auto;
        width: 100%;
        padding: 7%;
    }

    .wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .matriz-wrapper::after {
        display: block;
    }

    .numero-periodo { 
        font-size: 1.1rem; 
        flex: 0 0 28px; 
    }
    .disciplina { 
        font-size: 0.72rem; 
        padding: 8px 5px; 
    }
    .codigo { 
        font-size: 0.62rem; 
    }

    .aside {
        position: fixed;
        right: -300px;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        overflow-y: auto;
        width: 300px;
        z-index: 1000;
        transition: 0.3s;
        background-color: var(--cor-branco);
        box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    }

    /* Quando o aside estiver ativo via JS */
    .aside.active {
        right: 0;
    }

    .aside-toggle {
        display: block; /* Mostra o botão no mobile */
    }

    .footer {
        padding: 40px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .footer img {
        max-width: 100%;
        height: auto;
    }

    .footerGrid, 
    .footerLogosTop {
        grid-template-columns: 1fr !important; 
        gap: 30px;
    }

    .footerColumn {
        width: 100%;
        text-align: left;
    }

    .logoRowFull {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        justify-items: start;
    }

    .disciplinas-wrapper {
        gap: 8px;
    }

    .disciplina {
        flex: 1 1 calc(50% - 8px);
        min-width: unset;
        font-size: 0.72rem;
        padding: 10px 6px;
    }

    .disciplina:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 18px rgba(0,0,0,0.18);
    }

    .numero-periodo {
        font-size: 1.1rem;
    }
}