/* ==========================================================================
   Kimaya Landing Page — Header Component Styles & Sticky Navigation
   Makes the navbar sticky for both desktop and mobile/tablet viewports.
   ========================================================================== */

/* ── Prevent horizontal overflow from breaking sticky/fixed context ── */
html, body, .main-wrapper {
    overflow-x: clip;
}

/* ── Fixed/Sticky Header Base (Desktop & Mobile) ── */
header.header,
header.header-ten,
.header.home-menu,
.header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1050 !important;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(231, 166, 161, 0.2);
    box-shadow: 0 2px 15px rgba(110, 61, 104, 0.04);
    transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
}

/* ── Scrolled Sticky State (Active Shadow & Elevation) ── */
header.header.is-sticky,
header.header-ten.is-sticky,
header.header.header-sticky,
header.header.fixed {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(231, 166, 161, 0.3) !important;
    box-shadow: 0 4px 20px rgba(110, 61, 104, 0.08) !important;
}

/* ── Spacer for page content under fixed header ── */
/* Since the header is fixed, we use header height in data-component placeholder wrapper */
.main-wrapper > [data-component="header"] {
    display: block;
    height: 96px; /* Space reserved for the large header on desktop */
}

/* ── Navbar Layout Container ── */
.header .header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    transition: padding 0.3s ease;
    background: transparent !important;
}

header.header.is-sticky .header-nav,
header.header-ten.is-sticky .header-nav {
    padding: 8px 0;
}

/* ── Brand Logo (Large and Prominent) ── */
.header .navbar-brand.logo {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin: 0;
}

.header .navbar-brand.logo img {
    max-height: 72px; /* Large, prominent logo requested by user */
    width: auto;
    object-fit: contain;
    transition: max-height 0.3s ease;
}

header.header.is-sticky .navbar-brand.logo img {
    max-height: 60px; /* Slightly scaled down when scrolling for neat design */
}

/* ── Desktop Navigation Links (min-width: 992px) ── */
@media (min-width: 992px) {
    #mobile_btn {
        display: none !important;
    }

    .header .main-menu-wrapper {
        display: flex;
        align-items: center;
    }

    .header .main-nav {
        display: flex;
        align-items: center;
        margin: 0;
        padding: 0;
        gap: 28px;
    }

    .header .main-nav > li {
        height: auto !important;
        display: flex;
        align-items: center;
        margin: 0;
    }

    .header .main-nav > li > a {
        font-size: 15px;
        font-weight: 500;
        color: #1E293B;
        padding: 6px 0 !important;
        text-decoration: none;
        position: relative;
        transition: color 0.25s ease;
    }

    .header .main-nav > li > a:hover {
        color: #6E3D68 !important;
    }

    .header .main-nav > li.active > a {
        color: #CB928D !important;
        font-weight: 600;
    }

    /* Desktop Dropdown Submenu */
    .header .main-nav li.has-submenu {
        position: relative;
    }

    .header .main-nav li.has-submenu > .submenu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 220px;
        background: #ffffff;
        box-shadow: 0 10px 30px rgba(110, 61, 104, 0.12);
        border-radius: 12px;
        padding: 10px 0;
        margin-top: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
        list-style: none;
        z-index: 1000;
        border: 1px solid rgba(231, 166, 161, 0.25);
    }

    /* Invisible hover bridge to prevent mouse leave gap */
    .header .main-nav li.has-submenu > .submenu::before {
        content: '';
        position: absolute;
        top: -15px;
        left: 0;
        right: 0;
        height: 15px;
        background: transparent;
    }

    .header .main-nav li.has-submenu:hover > .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .header .main-nav li.has-submenu > .submenu li {
        display: block;
        margin: 0;
        padding: 0;
    }

    .header .main-nav li.has-submenu > .submenu li a {
        display: block;
        padding: 9px 20px !important;
        font-size: 14px;
        color: #334155;
        text-decoration: none;
        transition: background 0.2s ease, color 0.2s ease;
        white-space: nowrap;
    }

    .header .main-nav li.has-submenu > .submenu li a:hover {
        background: rgba(231, 166, 161, 0.12);
        color: #6E3D68 !important;
    }
}

/* Mobile Submenu Styling (max-width: 991.98px) */
@media (max-width: 991.98px) {
    .header .main-nav li.has-submenu > .submenu {
        display: none;
        list-style: none;
        padding-left: 14px;
        margin: 6px 0 12px 10px;
        border-left: 2px solid #E7A6A1;
    }

    .header .main-nav li.has-submenu > .submenu li {
        display: block;
        margin: 6px 0;
    }

    .header .main-nav li.has-submenu > .submenu li a {
        font-size: 14px;
        color: #475569;
        padding: 6px 12px !important;
        display: block;
        text-decoration: none;
    }

    .header .main-nav li.has-submenu > .submenu li a:hover {
        color: #6E3D68 !important;
    }
}

/* ── Right-Side Action / Consultation Button ── */
.header .header-navbar-rht {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.header .header-navbar-rht li {
    display: flex;
    align-items: center;
    padding: 0;
}

.header .header-navbar-rht .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    border-radius: 50px;
    padding: 10px 22px;
    font-size: 14px;
    background: #6E3D68;
    color: #ffffff;
    border: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.header .header-navbar-rht .btn:hover {
    background: #582f53;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(110, 61, 104, 0.25);
}

.header .header-navbar-rht .btn i {
    font-size: 16px;
    margin: 0;
}

/* ── Mobile & Tablet Sticky Layout (max-width: 991px) ── */
@media (max-width: 991.98px) {
    header.header,
    header.header-ten {
        padding: 4px 0;
        background: rgba(255, 255, 255, 0.98);
    }

    .main-wrapper > [data-component="header"] {
        height: 92px; /* Mobile header spacer */
    }

    .header .header-nav {
        padding: 8px 0;
        height: auto;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .header .navbar-header {
        display: flex;
        align-items: center;
        gap: 12px;
        width: auto !important;
        flex-direction: row !important;
        order: 1 !important;
        flex-shrink: 0 !important;
    }

    /* Mobile Hamburger Trigger */
    .header #mobile_btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        background: rgba(231, 166, 161, 0.15);
        color: #6E3D68;
        font-size: 18px;
        text-decoration: none;
        border: 1px solid rgba(231, 166, 161, 0.25);
        transition: all 0.25s ease;
        margin: 0;
        order: 3 !important;
    }

    .header #mobile_btn:hover {
        background: #6E3D68;
        color: #ffffff;
    }

    /* Mobile Logo */
    .header .navbar-brand.logo img {
        max-height: 70px;
    }

    /* Ensure CTA Button is visible, positioned on the right beside the menu trigger, and circular on mobile */
    .header .header-nav .header-navbar-rht {
        display: flex !important;
        order: 2 !important;
        flex: none !important;
        margin-left: auto !important;
        margin-right: 12px !important;
    }

    .header .header-navbar-rht .btn span {
        display: none !important;
    }

    .header .header-navbar-rht .btn {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .header .header-navbar-rht .btn i {
        font-size: 20px !important;
        margin: 0 !important;
    }

    /* Slide-out Mobile Menu Drawer (sliding from the right) */
    .main-menu-wrapper {
        position: fixed !important;
        top: 0 !important;
        left: auto !important;
        right: 0 !important; /* Position on the right */
        width: 280px !important;
        height: 100vh !important;
        z-index: 1060 !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15) !important; /* Shadow on the left */
        transform: translateX(280px) !important; /* Slide off-screen to the right */
        transition: transform 0.35s ease-in-out !important;
    }

    html.menu-opened .main-menu-wrapper {
        transform: translateX(0) !important;
    }

    /* Disable wrapper translation slide shifting to prevent right-side drawer slide behavior */
    .main-wrapper.slide-nav {
        transform: none !important;
        left: 0 !important;
    }

    /* Mobile Drawer overlay backdrop */
    .sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 1045 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.35s ease, visibility 0.35s ease !important;
    }

    .sidebar-overlay.opened {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

/* ── Small Mobile Screens (max-width: 575px) ── */
@media (max-width: 575.98px) {
    header.header,
    header.header-ten {
        padding: 2px 0;
    }

    .main-wrapper > [data-component="header"] {
        height: 82px;
    }

    .header .navbar-brand.logo img {
        max-height: 60px;
    }

    .header #mobile_btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
}

/* ── Dark Mode Adaptations ── */
:root.dark-mode header.header,
:root.dark-mode header.header-ten {
    background: rgba(21, 21, 21, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

:root.dark-mode header.header.is-sticky,
:root.dark-mode header.header-ten.is-sticky {
    background: rgba(21, 21, 21, 0.98) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

:root.dark-mode .header .main-nav > li > a {
    color: #EFEFEF;
}

:root.dark-mode .header .main-nav > li > a:hover {
    color: #CB928D !important;
}

:root.dark-mode .header .main-nav > li.active > a {
    color: #E7A6A1 !important;
}

:root.dark-mode .header #mobile_btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.15);
}

:root.dark-mode .main-menu-wrapper {
    background: #1e1e1e !important;
}
