/* ==========================================================================
   MOBILE NAV - Off-Canvas Drawer
   ==========================================================================
   A clean off-canvas slide-in drawer for mobile (<992px).
   Stacking order:
     .navbar              z-index: 1030  (sticky header)
     #mobile-nav-overlay  z-index: 1040  (dark backdrop)
     #mobile-nav-drawer   z-index: 1050  (drawer panel)
     .disclaimer-popup    z-index: 1035  (stays below overlay)
   ========================================================================== */

/* ------------------------------------------------------------------
   1. Prevent body scroll when drawer is open
   ------------------------------------------------------------------ */
body.mobile-menu-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   2. Dark backdrop overlay
   ------------------------------------------------------------------ */
#mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#mobile-nav-overlay.visible {
    display: block;
}

#mobile-nav-overlay.active {
    opacity: 1;
}

/* ------------------------------------------------------------------
   3. Off-canvas drawer panel
   ------------------------------------------------------------------ */
#mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 88vw);
    height: 100%;
    height: 100dvh;
    /* dynamic viewport height for iOS */
    background: #ffffff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.18);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobile-nav-drawer.open {
    right: 0;
}

/* ------------------------------------------------------------------
   4. Drawer header (logo + close button)
   ------------------------------------------------------------------ */
.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e8eaf0;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
}

.mobile-drawer-logo img {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.mobile-drawer-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:focus {
    background: #e5e7eb;
    transform: scale(1.08);
    outline: none;
}

/* ------------------------------------------------------------------
   5. Drawer nav list
   ------------------------------------------------------------------ */
.mobile-drawer-nav {
    flex: 1;
    padding: 12px 0 20px;
    list-style: none;
    margin: 0;
}

.mobile-drawer-nav>li {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-drawer-nav>li:last-child {
    border-bottom: none;
}

.mobile-drawer-nav .drawer-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #0F172A;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    gap: 10px;
}

.mobile-drawer-nav .drawer-nav-link:hover,
.mobile-drawer-nav .drawer-nav-link:focus {
    color: #0E5AA7;
    background: #f0f7ff;
    outline: none;
}

.mobile-drawer-nav .drawer-nav-link.active-page {
    color: #0E5AA7;
    background: #f0f7ff;
}

/* Dropdown caret icon */
.drawer-caret {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8ecf3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.25s ease, background 0.2s ease;
}

.drawer-dropdown-wrapper.open>.drawer-nav-link .drawer-caret {
    transform: rotate(180deg);
    background: #dbeafe;
    color: #0E5AA7;
}

/* ------------------------------------------------------------------
   6. Drawer dropdown accordion
   ------------------------------------------------------------------ */
.drawer-dropdown-wrapper>.drawer-nav-link {
    cursor: pointer;
}

.drawer-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8faff;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.drawer-dropdown-wrapper.open>.drawer-dropdown-menu {
    max-height: 600px;
    /* large enough to show all items */
}

.drawer-dropdown-menu li a {
    display: block;
    padding: 11px 20px 11px 38px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    border-left: 3px solid transparent;
}

.drawer-dropdown-menu li a:hover,
.drawer-dropdown-menu li a:focus {
    color: #0E5AA7;
    background: #e8f1fd;
    border-left-color: #0E5AA7;
    outline: none;
}

.drawer-dropdown-menu .drawer-dropdown-header {
    padding: 10px 20px 6px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0E5AA7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f0f7ff;
}

/* ------------------------------------------------------------------
   7. Drawer footer CTA section (phone + book button)
   ------------------------------------------------------------------ */
.mobile-drawer-footer {
    padding: 20px;
    border-top: 1px solid #e8eaf0;
    background: #ffffff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-cta-book {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: linear-gradient(90deg, #0E5AA7 0%, #2F80ED 55%, #35C4E8 100%);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 50px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.drawer-cta-book:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    color: #fff !important;
}

.drawer-cta-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    background: #f0f7ff;
    color: #0E5AA7 !important;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 50px;
    text-decoration: none;
    border: 1.5px solid #bfdbfe;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.drawer-cta-phone:hover {
    background: #dbeafe;
    color: #0B3D73 !important;
}

/* ------------------------------------------------------------------
   8. Desktop: hide drawer entirely, show normal navbar
   ------------------------------------------------------------------ */
@media (min-width: 992px) {

    #mobile-nav-overlay,
    #mobile-nav-drawer {
        display: none !important;
    }

    /* Ensure desktop hamburger toggle is hidden (Bootstrap handles this) */
    .navbar-toggler {
        display: none !important;
    }
}

/* ------------------------------------------------------------------
   9. Mobile: clean header bar (logo left, hamburger right)
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {

    /* Hide the Bootstrap collapse nav menu on mobile — use drawer instead */
    .navbar-collapse {
        display: none !important;
    }

    /* Clean header row */
    .navbar>.container-fluid {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Logo: compact on mobile */
    .navbar-brand img {
        max-height: 64px !important;
        width: auto !important;
    }

    /* Hamburger button: right-aligned, proper spacing */
    .navbar-toggler {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: none;
        border-radius: 8px;
        background-color: #f0f7ff;
        flex-shrink: 0;
        cursor: pointer;
        transition: background 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .navbar-toggler:hover,
    .navbar-toggler:focus {
        background-color: #dbeafe;
        outline: none;
        box-shadow: none;
    }

    /* Navbar compact height on mobile */
    .navbar {
        padding: 8px 0 !important;
        min-height: auto !important;
        height: auto !important;
    }

    /* Keep disclaimer bar below the mobile overlay */
    .disclaimer-popup-bar {
        z-index: 1035 !important;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand img {
        max-height: 58px !important;
    }
}

@media (max-width: 374px) {
    #mobile-nav-drawer {
        width: 94vw;
    }

    .navbar-brand img {
        max-height: 52px !important;
    }
}