/* ===== TOPBAR ===== */
.topbar {
    background: linear-gradient(90deg, var(--azul-oscuro) 0%, var(--azul-principal) 100%);
    padding: 0.45rem 0;
    overflow: hidden;
}

.topbar-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.88);
    font-family: var(--font-body);
    font-weight: 400;
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.2s;
}

.topbar-item:hover { color: #fff; }

.topbar-item i {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.65);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-social {
    display: flex;
    gap: 0.5rem;
}

.topbar-social a {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.85);
    font-size: 0.6rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.topbar-social a:hover {
    background: rgba(255,255,255,0.30);
    color: #fff;
}

/* ===== HEADER PRINCIPAL ===== */
.site-header {
    background-color: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0,98,204,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.site-header.scrolled {
    background-color: rgba(255,255,255,0.98);
    box-shadow: 0 4px 24px rgba(0,62,130,0.10);
    border-bottom-color: transparent;
}

/* Línea de acento inferior animada al scroll */
.site-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--azul-principal), var(--azul-acento));
    transition: width 0.4s ease;
    pointer-events: none;
}

.site-header.scrolled::after { width: 100%; }

/* ===== CONTAINER ===== */
.header-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* ===== LOGO ===== */
.logo a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--azul-principal), var(--azul-oscuro));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,98,204,0.30);
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.logo a:hover .logo-icon {
    transform: rotate(-6deg) scale(1.05);
    box-shadow: 0 6px 18px rgba(0,98,204,0.38);
}

.logo-icon i {
    font-size: 1rem;
    color: var(--blanco);
}

.logo-img {
    height: 38px;
    width: auto;
}

.logo-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--gris-texto);
}

.logo-name span { color: var(--azul-principal); }

.logo-tagline {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gris-suave);
    margin-top: 2px;
}

/* ===== NAVEGACIÓN ===== */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--gris-suave);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    position: relative;
    transition: color 0.2s, background-color 0.2s;
    letter-spacing: 0.005em;
}

.nav-link:hover {
    color: var(--azul-principal);
    background-color: rgba(0,98,204,0.05);
}

.nav-link.active {
    color: var(--azul-principal);
    background-color: rgba(0,98,204,0.08);
    font-weight: 600;
}

/* Punto indicador del enlace activo */
.nav-link.active::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--azul-principal);
    border-radius: 50%;
}

/* ===== CTA DEL HEADER ===== */
.nav-cta {
    margin-left: 1rem;
}

.btn-header-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #25D366, #1aad54);
    color: var(--blanco);
    padding: 0.55rem 1.25rem;
    border-radius: 10px;
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(37,211,102,0.30);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    white-space: nowrap;
}

.btn-header-cta i { font-size: 1rem; }

.btn-header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,211,102,0.40);
    filter: brightness(1.06);
    color: var(--blanco);
}

/* ===== BOTÓN HAMBURGUESA ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: rgba(0,98,204,0.06);
    border: 1px solid rgba(0,98,204,0.12);
    border-radius: 9px;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: background 0.2s;
    flex-shrink: 0;
}

.menu-toggle:hover { background: rgba(0,98,204,0.10); }

.menu-toggle .bar {
    width: 18px;
    height: 2px;
    background-color: var(--azul-principal);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.menu-toggle .bar:nth-child(3) { width: 12px; }

.menu-toggle.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 18px; }

/* ===== MENÚ MÓVIL ===== */
@media (max-width: 860px) {
    .topbar-left .topbar-item:nth-child(2) { display: none; }
}

@media (max-width: 768px) {
    .topbar { display: none; }

    .header-container { height: 64px; padding: 0 1.25rem; }

    .menu-toggle { display: flex; }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(85%, 320px);
        height: 100dvh;
        background-color: var(--blanco);
        box-shadow: -4px 0 40px rgba(0,62,130,0.14);
        padding: 5rem 1.75rem 2.5rem;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        overflow-y: auto;
    }

    .main-nav.active { right: 0; }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        width: 100%;
    }

    .nav-item { width: 100%; }

    .nav-link {
        display: flex;
        align-items: center;
        width: 100%;
        font-size: 1.05rem;
        padding: 0.75rem 1rem;
        border-radius: 10px;
    }

    .nav-link.active::before {
        left: auto;
        right: 1rem;
        bottom: 50%;
        transform: translateY(50%);
        width: 6px;
        height: 6px;
    }

    .nav-cta {
        margin-left: 0;
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(0,0,0,0.07);
    }

    .btn-header-cta {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    /* Overlay */
    body.menu-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background-color: rgba(10,20,40,0.45);
        backdrop-filter: blur(2px);
        z-index: 999;
        animation: fadeIn 0.25s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

@media (min-width: 769px) {
    .main-nav {
        display: flex !important;
        position: static;
        height: auto;
        width: auto;
        box-shadow: none;
        padding: 0;
        background: transparent;
        overflow: visible;
    }
}

@media (max-width: 400px) {
    .logo-tagline { display: none; }
}