/* ============================================
   CEPO - Header Styles
   Fiel al diseño de Figma: Header component (452:147)

   Estructura:
   - .cepo-header: Contenedor principal
   - .cepo-header__top: Barra superior blanca (logo + admisiones)
   - .cepo-header__nav: Barra de navegación verde
   ============================================ */

/* ---- Header Principal ---- */
.cepo-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background-color: var(--color-bg-white);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.cepo-header.is-scrolled {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ---- Barra Superior (Blanca) ---- */
.cepo-header__top {
    background-color: var(--color-bg-white);
    width: 100%;
}

.cepo-header__top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 20px 56px;
    transition: padding 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__top-inner {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* ---- Brand (Logo + Nombre) ---- */
.cepo-header__brand {
    display: flex;
    align-items: center;
    gap: 28px;
    text-decoration: none;
}

.cepo-header__brand:hover {
    opacity: 1;
}

.cepo-header__logo {
    width: 121px;
    height: 130px;
    object-fit: cover;
    flex-shrink: 0;
    transition: width 0.3s ease, height 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__logo {
    width: 50px;
    height: 54px;
}

.cepo-header__brand-text {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 266px;
    transition: gap 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__brand-text {
    gap: 2px;
}

.cepo-header__brand-subtitle {
    font-family: var(--font-primary);
    font-weight: var(--fw-semibold);
    font-size: 18px;
    color: var(--color-green-dark);
    letter-spacing: 3.6px;
    line-height: normal;
    transition: font-size 0.3s ease, letter-spacing 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__brand-subtitle {
    font-size: 11px;
    letter-spacing: 2px;
}

.cepo-header__brand-title {
    font-family: var(--font-primary);
    font-weight: var(--fw-bold);
    font-size: 24px;
    color: var(--color-green-primary);
    letter-spacing: 2.88px;
    line-height: normal;
    transition: font-size 0.3s ease, letter-spacing 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__brand-title {
    font-size: 15px;
    letter-spacing: 1.5px;
}

/* ---- Botón Admisiones ---- */
.cepo-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.cepo-header__admisiones-btn {
    font-size: var(--fs-md);
    padding: 12px 20px;
}

/* ---- Hamburguesa (Mobile) ---- */
.cepo-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.cepo-header__hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--color-green-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animación hamburguesa activa */
.cepo-header__hamburger[aria-expanded="true"] .cepo-header__hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.cepo-header__hamburger[aria-expanded="true"] .cepo-header__hamburger-line:nth-child(2) {
    opacity: 0;
}

.cepo-header__hamburger[aria-expanded="true"] .cepo-header__hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ---- Barra de Navegación Verde ---- */
.cepo-header__nav {
    background-color: var(--color-green-primary);
    width: 100%;
}

.cepo-header__nav-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 20px 204px;
    position: relative;
    transition: padding 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__nav-inner {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ---- Menú Principal ---- */
.cepo-header__menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Asegurar que TODOS los enlaces dentro del nav sean blancos */
.cepo-header__nav a {
    color: var(--color-white);
}

.cepo-header__menu-item {
    position: relative;
}

.cepo-header__menu-link {
    font-family: var(--font-primary);
    font-weight: var(--fw-semibold);
    font-size: 18px;
    color: var(--color-white);
    white-space: nowrap;
    line-height: normal;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: opacity 0.3s ease, font-size 0.3s ease;
}

.cepo-header.is-scrolled .cepo-header__menu-link {
    font-size: 15px;
}

.cepo-header__menu-link:hover {
    opacity: 0.85;
}

/* Item activo */
.cepo-header__menu-item--active > .cepo-header__menu-link {
    opacity: 1;
    border-bottom: 2px solid var(--color-white);
    padding-bottom: 2px;
}

/* ---- Flecha Dropdown ---- */
.cepo-header__dropdown-arrow {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.cepo-header__menu-item--has-children:hover .cepo-header__dropdown-arrow {
    transform: rotate(180deg);
}

/* ---- Submenú (Dropdown) ---- */
.cepo-header__menu-item--has-children {
    position: relative;
}

.cepo-header__submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background-color: var(--color-bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    padding-top: 18px;
    list-style: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Puente invisible para mantener hover entre menu item y dropdown */
.cepo-header__submenu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.cepo-header__menu-item--has-children:hover > .cepo-header__submenu {
    display: block;
    opacity: 1;
}

.cepo-header__submenu-item {
    display: block;
}

.cepo-header__submenu-link {
    display: block;
    padding: 10px 20px;
    font-family: var(--font-primary);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--color-black) !important;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cepo-header__submenu-link:hover {
    background-color: var(--color-bg-input);
    color: var(--color-green-primary);
    opacity: 1;
}

/* ---- Enlace Aula Virtual ---- */
.cepo-header__aula-virtual {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-family: var(--font-primary);
    font-weight: var(--fw-semibold);
    font-size: 18px;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.cepo-header__aula-virtual:hover {
    opacity: 0.85;
}

.cepo-header__aula-virtual svg {
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE: Tablet (768px)
   ============================================ */
@media (max-width: 768px) {
    .cepo-header__top-inner {
        padding: 15px 24px;
    }

    .cepo-header__logo {
        width: 70px;
        height: 75px;
    }

    .cepo-header__brand {
        gap: 15px;
    }

    .cepo-header__brand-text {
        width: auto;
        gap: 3px;
    }

    .cepo-header__brand-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .cepo-header__brand-title {
        font-size: 16px;
        letter-spacing: 1.5px;
    }

    .cepo-header__admisiones-btn {
        font-size: 14px;
        padding: 8px 16px;
    }

    /* Mostrar hamburguesa */
    .cepo-header__hamburger {
        display: flex;
    }

    .cepo-header__actions {
        display: none;
    }

    /* Nav mobile */
    .cepo-header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 1000;
        padding-top: 80px;
    }

    .cepo-header__nav.is-open {
        right: 0;
    }

    .cepo-header__nav-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 24px;
        gap: 0;
    }

    .cepo-header__menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
    }

    .cepo-header__menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    .cepo-header__menu-link {
        padding: 15px 0;
        font-size: 16px;
        width: 100%;
        justify-content: space-between;
    }

    /* Submenú mobile */
    .cepo-header__submenu {
        position: static;
        transform: none;
        min-width: auto;
        background-color: rgba(0, 0, 0, 0.15);
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        margin-top: 0;
    }

    .cepo-header__menu-item--has-children:hover > .cepo-header__submenu {
        display: none;
    }

    .cepo-header__menu-item--has-children.is-open > .cepo-header__submenu {
        display: block;
        opacity: 1;
    }

    .cepo-header__submenu-link {
        color: var(--color-white);
        padding: 12px 20px;
        font-size: 14px;
    }

    .cepo-header__submenu-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: var(--color-white);
    }

    /* Aula Virtual mobile */
    .cepo-header__aula-virtual {
        position: static;
        transform: none;
        margin-top: 20px;
        padding: 15px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        width: 100%;
    }
}

/* ============================================
   RESPONSIVE: Mobile (480px)
   ============================================ */
@media (max-width: 480px) {
    .cepo-header__top-inner {
        padding: 10px 16px;
    }

    .cepo-header__logo {
        width: 50px;
        height: 54px;
    }

    .cepo-header__brand {
        gap: 10px;
    }

    .cepo-header__brand-subtitle {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .cepo-header__brand-title {
        font-size: 13px;
        letter-spacing: 1px;
    }

    .cepo-header__nav {
        width: 100%;
        max-width: 100%;
    }
}

/* ---- Overlay para menú móvil ---- */
.cepo-header__overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cepo-header__overlay.is-visible {
    display: block;
    opacity: 1;
}
