/**
 * KB Header Styles
 * ================================================
 * 
 * Standalone header styles matching dashboard design EXACTLY.
 * Uses ONLY base.css design tokens - NO Astra theme styles.
 * 
 * @package Kabalah Universal
 * @since 1.0.0
 */

/* ============================================
   OVERRIDE ANY ASTRA THEME STYLES
   ============================================ */
#kb-header * {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* ============================================
   HEADER BASE STRUCTURE
   ============================================ */
.kb-header {
    position: sticky;
    top: 0;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Higher specificity to override base.css demo banner offset */
#kb-header.kb-header {
    position: sticky !important;
    top: 0 !important;
}

.kb-header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kb-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    gap: 2rem;
}

/* ============================================
   LOGO ZONE (Left)
   ============================================ */
.kb-header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.kb-header-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.kb-header-logo a:hover {
    opacity: 0.8;
}

.kb-header-logo img,
.kb-header-logo-img {
    max-height: 50px;
    width: auto;
    height: auto;
}

.kb-header-site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a5f;
    text-decoration: none;
}

/* ============================================
   NAVIGATION ZONE (Center)
   ============================================ */
.kb-header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.kb-header-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.kb-header-menu li {
    margin: 0;
    padding: 0;
}

.kb-header-menu a {
    text-decoration: none !important;
    color: #1e3a5f !important;
    /* Brand Blue FORCED */
    font-size: 17px !important;
    font-weight: 600 !important;
    /* Slightly bolder for clarity */
    font-family: 'Outfit', sans-serif !important;
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    background: transparent !important;
}

.kb-header-menu a:hover {
    color: #1e3a5f !important;
    /* Keep same Dark Blue on hover */
    transform: scale(1.08);
    /* Only Zoom Effect */
    background: transparent !important;
}

.kb-header-menu a:focus,
.kb-header-menu a:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Icon styles - Ensure they inherit color */
.kb-header-menu a svg {
    width: 18px;
    height: 18px;
    margin-top: -2px;
    /* Slight alignment fix */
    stroke-width: 2;
    color: inherit;
    /* Follow text color */
}

/* Cleaned up duplicate styles to avoid conflicts */

/* Current menu item */
.kb-header-menu .current-menu-item a,
.kb-header-menu .current_page_item a {
    color: #1e3a5f;
    font-weight: 600;
}

/* ============================================
   CTA ZONE (Right)
   ============================================ */
.kb-header-cta {
    margin-left: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    /* Space between buttons */
}

/* Contact Button Styles (Inverted: Outline -> Solid) */
.kb-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: transparent !important;
    /* Outline Default */
    color: #1e3a5f !important;
    /* Blue Text Default */
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid #1e3a5f !important;
    height: auto;
    line-height: 1;
    cursor: pointer;
}

.kb-contact-btn:hover {
    background-color: #1e3a5f !important;
    /* Solid Blue on Hover */
    color: #ffffff !important;
    /* White Text on Hover */
    transform: translateY(-1px);
}

.kb-contact-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Login Button Styles (Course Card Style Match + Outline Hover) */
.kb-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #1e3a5f !important;
    /* Force Brand Blue Background */
    color: #ffffff !important;
    /* Force White Text */
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid #1e3a5f;
    height: auto;
    line-height: 1;
}

.kb-login-btn:hover {
    background-color: #ffffff !important;
    /* White Bg on Hover */
    color: #1e3a5f !important;
    /* Brand Blue Text on Hover */
    border-color: #1e3a5f !important;
    transform: translateY(-1px);
}

.kb-login-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Hide mobile CTA on desktop */
.kb-mobile-cta {
    display: none;
}

.kb-header-mobile-actions {
    display: none;
}

.kb-mobile-access-btn {
    display: none;
}

.kb-mobile-access-btn {
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    height: 36px;
    min-height: 36px;
    padding: 0 0.72rem;
    border-radius: 10px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: #1e3a5f;
    color: #ffffff !important;
    text-decoration: none !important;
    box-shadow: 0 6px 14px rgba(30, 58, 95, 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

.kb-mobile-access-btn:hover,
.kb-mobile-access-btn:focus-visible {
    background: #173250;
    color: #ffffff !important;
    border-color: rgba(30, 58, 95, 0.28);
    box-shadow: 0 10px 22px rgba(30, 58, 95, 0.18);
    transform: translateY(-1px);
    outline: none;
}

.kb-mobile-access-btn svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    stroke-width: 2.2;
}

.kb-mobile-access-btn span {
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
}

/* ============================================
   MOBILE MENU OVERLAY (estilo login)
   ============================================ */
.kb-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f1f5f9;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    overscroll-behavior: none;
}

.kb-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.kb-mobile-nav {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100%;
    gap: 0.85rem;
    padding: calc(88px + env(safe-area-inset-top)) 1.35rem calc(2rem + env(safe-area-inset-bottom));
    width: min(100%, 480px);
    margin: 0 auto;
}

.kb-mobile-nav .kb-header-menu {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 0.85rem;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.kb-mobile-nav .kb-header-menu li {
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

html.kb-mobile-menu-open,
body.kb-mobile-menu-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

.kb-mobile-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 1.02rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    border-radius: 18px;
    width: min(100%, 280px);
    max-width: 280px;
    margin: 0 auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.kb-mobile-nav a:active,
.kb-mobile-nav a:hover {
    background: #ffffff !important;
    color: #0f2747 !important;
    border-color: #ffffff !important;
    transform: translateY(-1px);
}

.kb-mobile-nav a:active svg,
.kb-mobile-nav a:hover svg {
    stroke: #0f2747 !important;
}

.kb-mobile-nav a svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff !important;
    transition: stroke 0.2s ease;
    flex-shrink: 0;
}

/* ============================================
   MOBILE HAMBURGER BUTTON
   ============================================ */
.kb-header-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    background: #f8fafc !important;
    border: 1px solid rgba(30, 58, 95, 0.14) !important;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
    color: #1e3a5f !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    appearance: none;
    -webkit-appearance: none;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.kb-header-hamburger:hover,
.kb-header-hamburger:focus-visible {
    background: #eef4f8 !important;
    border-color: rgba(30, 58, 95, 0.24) !important;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.kb-hamburger-line {
    width: 18px;
    height: 2px;
    background: #1e3a5f;
    border-radius: 2px;
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hamburger animation when active */
.kb-header-hamburger.active .kb-hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.kb-header-hamburger.active .kb-hamburger-line:nth-child(2) {
    opacity: 0;
}

.kb-header-hamburger.active .kb-hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ============================================
   RESPONSIVE DESIGN - TABLET
   ============================================ */
@media (max-width: 991px) {
    .kb-header-container {
        padding: 1rem 1.5rem;
        gap: 1.5rem;
    }

    .kb-header-menu {
        gap: 1rem;
    }

    .kb-header-menu a {
        font-size: 0.9375rem;
    }

    .kb-header-cta {
        display: none;
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */
@media (max-width: 1024px) {
    .kb-header {
        padding-top: env(safe-area-inset-top);
    }

    .kb-header-container {
        padding: 1rem;
        gap: 0.75rem;
    }

    .kb-header-logo {
        min-width: 0;
        flex: 1 1 auto;
    }

    /* Show hamburger button */
    .kb-header-hamburger {
        display: flex;
    }

    .kb-header-mobile-actions {
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.42rem;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .kb-header-nav {
        display: none !important;
    }

    .kb-mobile-access-btn {
        display: inline-flex;
    }

    .kb-header-cta {
        display: none;
    }

    /* Hide desktop nav on mobile */
    .kb-desktop-menu {
        display: none !important;
    }

    .kb-mobile-overlay {
        display: block;
        background:
            radial-gradient(circle at top right, rgba(255, 255, 255, 0.14), transparent 30%),
            radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.08), transparent 35%),
            linear-gradient(180deg, #0f2747 0%, #102f57 52%, #0b213d 100%);
        z-index: 999;
    }

    .kb-mobile-nav {
        justify-content: flex-start;
        gap: 0.95rem;
        padding-top: calc(92px + env(safe-area-inset-top));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .kb-header-logo img {
        max-height: 40px;
    }
}

@media (max-width: 480px) {
    .kb-header-container {
        padding: 0.85rem 0.8rem;
    }

    .kb-header-logo img {
        max-height: 36px;
    }

    .kb-mobile-nav {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: calc(88px + env(safe-area-inset-top));
    }

    .kb-mobile-nav .kb-header-menu {
        gap: 0.85rem;
    }

    .kb-mobile-nav a {
        gap: 0.85rem;
        font-size: 0.84rem;
        padding: 0.8rem 0.9rem;
        border-radius: 14px;
        width: min(100%, 256px);
        max-width: 256px;
    }

    .kb-mobile-nav a svg {
        width: 19px;
        height: 19px;
    }

    .kb-mobile-access-btn {
        height: 34px;
        min-height: 34px;
        padding: 0 0.66rem;
        border-radius: 9px;
    }

    .kb-mobile-access-btn span {
        font-size: 0.72rem;
    }

    .kb-header-hamburger {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .kb-hamburger-line {
        width: 17px;
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus states */
.kb-header-menu a:focus,
.kb-header-hamburger:focus {
    outline: 2px solid #1e3a5f;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .kb-header-menu a,
    .kb-hamburger-line,
    .kb-header-nav {
        transition: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .kb-header-hamburger,
    .kb-header-cta {
        display: none;
    }

    .kb-header {
        box-shadow: none;
        border-bottom: 1px solid #000;
    }
}

/* ============================================
   LOGIN MODAL POPUP
   ============================================/* Login Link Styles */
.kb-header-btn-login {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background-color: var(--color-primary, #1e3a5f);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 50px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.kb-header-btn-login:hover {
    background-color: transparent;
    color: var(--color-primary, #1e3a5f);
    border-color: var(--color-primary, #1e3a5f);
    transform: translateX(4px);
    /* Efecto sutil de desplazamiento a la derecha */
}

.kb-header-btn-login svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}