/**
 * 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;
}

/* ============================================
   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;
}

.kb-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.kb-mobile-nav {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 0.75rem;
    padding: 2rem;
}

.kb-mobile-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #1e3a5f !important;
    text-decoration: none !important;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    border-radius: 10px;
    width: 100%;
    max-width: 260px;
    background: #ffffff !important;
    border: 2px solid #1e3a5f !important;
    transition: all 0.2s ease;
}

.kb-mobile-nav a:active,
.kb-mobile-nav a:hover {
    background: #1e3a5f !important;
    color: #ffffff !important;
}

.kb-mobile-nav a:active svg,
.kb-mobile-nav a:hover svg {
    stroke: #ffffff !important;
}

.kb-mobile-nav a svg {
    width: 22px;
    height: 22px;
    stroke: #1e3a5f !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: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.kb-hamburger-line {
    width: 24px;
    height: 2px;
    background: #1e293b;
    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(7px) 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(-7px) 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: 768px) {
    .kb-header-container {
        padding: 1rem;
    }

    /* Show hamburger button */
    .kb-header-hamburger {
        display: flex;
    }

    /* Hide navigation by default */
    .kb-header-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        padding: 0.5rem 1.5rem 2rem;
        transition: right 350ms cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1050;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Navigation active state */
    .kb-header-nav.active {
        right: 0;
    }

    /* Mobile menu layout */
    .kb-header-menu {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0 !important;
        width: 100% !important;
        flex-wrap: nowrap !important;
    }

    .kb-header-menu li {
        width: 100%;
        border-bottom: 1px solid #e2e8f0;
    }

    .kb-header-menu a {
        display: block;
        width: 100%;
        padding: 1rem 0;
        font-size: 1.125rem;
        transform: none;
    }

    .kb-header-menu a:hover {
        transform: none;
        background: transparent !important;
        color: #1e3a5f !important;
    }

    /* Mobile CTA buttons inside menu - styled like menu items */
    .kb-mobile-cta {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .kb-mobile-cta .kb-contact-btn,
    .kb-mobile-cta .kb-login-btn {
        display: flex !important;
        align-items: center;
        justify-content: flex-start !important;
        gap: 6px;
        width: 100%;
        padding: 1rem 0;
        font-size: 1.125rem !important;
        font-weight: 600 !important;
        background: transparent !important;
        color: #1e3a5f !important;
        border: none !important;
        border-bottom: 1px solid #e2e8f0;
        border-radius: 0 !important;
        text-align: left;
    }

    .kb-mobile-cta .kb-contact-btn:hover,
    .kb-mobile-cta .kb-login-btn:hover {
        background: transparent !important;
        transform: none !important;
    }

    .kb-mobile-cta .kb-contact-btn svg,
    .kb-mobile-cta .kb-login-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Mobile overlay */
    .kb-header-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1040;
    }

    .kb-header-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Hide desktop CTA on mobile */
    .kb-header-cta {
        display: none;
    }

    /* Hide desktop nav on mobile */
    .kb-desktop-menu {
        display: none !important;
    }

    /* Show mobile overlay on mobile */
    .kb-mobile-overlay {
        display: block;
    }

    /* Mobile close button */
    .kb-mobile-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: #f1f5f9;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        margin-bottom: 0.5rem;
        align-self: flex-end;
    }

    .kb-mobile-close svg {
        width: 18px;
        height: 18px;
        color: #1e3a5f;
    }

    .kb-mobile-close:hover {
        background: #e2e8f0;
    }

    .kb-mobile-menu {
        display: flex !important;
        flex-direction: column !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .kb-mobile-menu li {
        width: 100%;
        border-bottom: 1px solid #e2e8f0;
    }

    .kb-mobile-menu a {
        display: flex !important;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 1rem 0;
        font-size: 1.125rem !important;
        font-weight: 600 !important;
        font-family: 'Outfit', sans-serif !important;
        background: transparent !important;
        color: #1e3a5f !important;
        text-decoration: none !important;
    }

    .kb-mobile-menu a:hover,
    .kb-mobile-menu a:active,
    .kb-mobile-menu a:focus {
        background: transparent !important;
        color: #1e3a5f !important;
        transform: none !important;
    }

    .kb-mobile-menu a svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    /* Remove any hover background on mobile menu items */
    .kb-header-menu li:hover,
    .kb-header-menu li:active,
    .kb-header-menu li:focus {
        background: transparent !important;
    }

    .kb-header-menu a:active,
    .kb-header-menu a:focus {
        background: transparent !important;
        outline: none !important;
    }

    /* Adjust logo size on very small screens */
    .kb-header-logo img {
        max-height: 40px;
    }
}

/* ============================================
   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;
}