/**
 * Qiblatain Tours — Header, Topbar & Navigation
 * Premium Islamic aesthetic with slide-in mobile drawer
 */

/* ==========================================
   TOPBAR
   ========================================== */
.topbar {
    background: var(--emerald);
    color: rgba(255,255,255,0.88);
    padding: 9px 0;
    font-size: 0.8rem;
    font-family: var(--font-primary);
    border-bottom: 1px solid rgba(196,150,58,0.18);
    position: relative;
    z-index: 1000;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-mobile-logo {
    display: none;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.topbar-mobile-logo img {
    height: 48px;
    width: auto;
    max-width: min(76vw, 280px);
    object-fit: contain;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.topbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 2px 0;
}

.topbar-item i { color: var(--gold-light); font-size: 0.78rem; }

.topbar-link {
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.topbar-link:hover { color: var(--gold-light); }

.topbar-whatsapp { color: #5CDB8F !important; }
.topbar-whatsapp:hover { color: #25D366 !important; }
.topbar-whatsapp i { color: #5CDB8F !important; }

.topbar-divider {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.2);
    margin: 0 12px;
    flex-shrink: 0;
}

.topbar-social {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: rgba(255,255,255,0.72);
    border-radius: 50%;
    transition: var(--transition-fast);
    text-decoration: none;
    font-size: 0.78rem;
}

.topbar-social-link:hover {
    color: var(--white);
    background: rgba(196,150,58,0.25);
    transform: scale(1.1);
}

/* ==========================================
   MAIN NAVBAR WRAPPER
   ========================================== */
.navbar {
    background: var(--white);
    position: sticky !important;
    top: 0 !important;
    z-index: 1200 !important;
    transition: box-shadow 0.3s ease, padding 0.3s ease, background 0.3s ease;
    border-bottom: 1px solid rgba(196,150,58,0.1);
    /* Override Bootstrap 5 .navbar defaults */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
}

/* Fallback fixed mode when sticky is blocked by conflicts */
.navbar.force-fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1200 !important;
}

body.navbar-force-fixed {
    padding-top: var(--navbar-fixed-offset, 76px);
}

/* Scrolled state — added by JS */
.navbar.scrolled {
    box-shadow: 0 2px 24px rgba(26,60,52,0.12);
    border-bottom-color: transparent;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    gap: 16px;
    transition: height 0.3s ease;
}

.navbar.scrolled .navbar-inner { height: 64px; }

/* ——— Logo ——— */
.navbar-brand {
    flex-shrink: 0;
    display: flex !important;           /* Bootstrap sets display:flex already */
    align-items: center;
    text-decoration: none;
    z-index: 1001;
    padding-top: 0 !important;          /* Bootstrap adds .3125rem padding */
    padding-bottom: 0 !important;
    margin-right: 0 !important;         /* Bootstrap adds 1rem margin-right */
    font-size: inherit !important;      /* Bootstrap overrides font-size */
}

.navbar-brand img {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    transition: height 0.3s ease, transform 0.3s ease;
}

.navbar.scrolled .navbar-brand img { height: 50px; }

.navbar-brand:hover img { transform: scale(1.03); }

/* ——— Center Nav ——— */
.navbar-nav {
    display: flex !important;          /* Bootstrap sets display:flex already but direction is wrong */
    flex-direction: row !important;    /* Bootstrap defaults to column without .navbar-expand-* */
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0 !important;            /* Bootstrap adds padding-left */
    gap: 2px;
    flex: 1;
    justify-content: center;
}

.nav-item { position: relative; }

.nav-link {
    display: flex !important;          /* Bootstrap sets display:block */
    align-items: center;
    gap: 4px;
    padding: 10px 16px !important;    /* Bootstrap overrides padding via CSS vars */
    color: var(--charcoal) !important; /* Bootstrap sets --bs-nav-link-color */
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    border-radius: 1px;
}

.nav-link:hover {
    color: var(--emerald);
    background: var(--emerald-pale);
}

.nav-link:hover::after { transform: scaleX(1); }

.nav-item.active > .nav-link {
    color: var(--emerald);
    background: var(--emerald-pale);
}

.nav-item.active > .nav-link::after { transform: scaleX(1); }

/* Dropdown chevron */
.dropdown-chevron {
    font-size: 0.65rem;
    margin-left: 2px;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.nav-item.dropdown:hover .dropdown-chevron { transform: rotate(180deg); }

/* ==========================================
   DROPDOWN MENUS
   — Bootstrap sets display:none on .dropdown-menu and uses JS to toggle.
     We override with display:block + visibility/opacity for CSS-only hover.
   ========================================== */
.navbar .dropdown-menu {
    display: block !important;         /* Override Bootstrap's display:none */
    position: absolute !important;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    background: var(--white);
    border-radius: var(--radius-md) !important;
    box-shadow: 0 12px 40px rgba(26,60,52,0.14), 0 0 0 1px rgba(196,150,58,0.14) !important;
    border: none !important;           /* Override Bootstrap border */
    padding: 8px 0 !important;
    list-style: none;
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    pointer-events: none;
}

.nav-item.dropdown:hover > .navbar .dropdown-menu,
.nav-item.dropdown:focus-within > .navbar .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Simpler selectors that work regardless of nesting */
.nav-item.dropdown:hover > .dropdown-menu,
.nav-item.dropdown:focus-within > .dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto;
}

.dropdown-menu .nav-item { display: block !important; width: 100%; }

.dropdown-menu .nav-link {
    padding: 10px 20px !important;
    border-radius: 0;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    color: var(--charcoal);
}

.dropdown-menu .nav-link::after { display: none; }

.dropdown-menu .nav-link:hover {
    background: var(--emerald-pale);
    color: var(--emerald);
    padding-left: 26px;
}

/* Nested dropdowns */
.dropdown-menu .dropdown { position: relative; }

.dropdown-menu .dropdown-menu {
    left: 100%;
    top: 0;
    margin-top: 0;
    margin-left: 4px;
}

.dropdown-menu .dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* ==========================================
   RIGHT SIDE — CTA Button
   ========================================== */
.navbar-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-phone-cta {
    display: none;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--white);
    background: var(--emerald);
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.btn-book-now {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--emerald);
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0.3px;
    text-decoration: none;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-gold);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-book-now::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-mid));
    opacity: 0;
    transition: opacity 0.35s ease;
}

.btn-book-now:hover::before { opacity: 1; }
.btn-book-now:hover {
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-book-now span,
.btn-book-now i { position: relative; z-index: 1; }

/* ==========================================
   MOBILE HAMBURGER TOGGLE
   ========================================== */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: var(--emerald-pale);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 8px;
    gap: 5px;
    transition: var(--transition-fast);
    flex-shrink: 0;
    z-index: 1060;
    position: relative;
}

.nav-hamburger:hover { background: var(--emerald); }
.nav-hamburger:hover .hamburger-line { background: var(--white); }

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--emerald);
    border-radius: 2px;
    transition: var(--transition-smooth);
    transform-origin: center;
}

/* Animated X state */
.nav-hamburger.is-active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-hamburger.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-hamburger.is-active { background: var(--emerald); }
.nav-hamburger.is-active .hamburger-line { background: var(--white); }

/* ==========================================
   MOBILE DRAWER OVERLAY
   ========================================== */
.nav-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,28,46,0.55);
    z-index: 1055;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.nav-drawer-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ==========================================
   MOBILE DRAWER PANEL
   ========================================== */
.nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(340px, 88vw);
    height: 100dvh;
    background: var(--white);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: right 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -12px 0 48px rgba(26,60,52,0.18);
}

.nav-drawer.is-open { right: 0; }

/* Drawer header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--emerald);
    flex-shrink: 0;
}

.drawer-logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.drawer-close {
    background: rgba(255,255,255,0.12);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--white);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.drawer-close:hover {
    background: rgba(255,255,255,0.22);
    transform: scale(1.08);
}

/* Drawer contact strip */
.drawer-contact {
    padding: 16px 24px;
    background: var(--emerald-pale);
    border-bottom: 1px solid var(--ivory-dark);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--charcoal);
    text-decoration: none;
    font-weight: 500;
}

.drawer-contact-item i { color: var(--emerald); width: 16px; }
.drawer-contact-item:hover { color: var(--emerald); }

/* Drawer nav list */
.drawer-nav {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1;
}

.drawer-nav-item {
    border-bottom: 1px solid var(--ivory-mid);
}

.drawer-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 24px;
    color: var(--charcoal);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.drawer-nav-link:hover,
.drawer-nav-item.active > .drawer-nav-link {
    color: var(--emerald);
    background: var(--emerald-pale);
    padding-left: 30px;
}

.drawer-nav-item.active > .drawer-nav-link {
    border-left: 3px solid var(--gold);
}

.drawer-chevron {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: var(--gold);
}

.drawer-nav-item.open > .drawer-nav-link .drawer-chevron { transform: rotate(90deg); }

/* Drawer sub-menu */
.drawer-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--ivory);
}

.drawer-nav-item.open > .drawer-submenu { max-height: 600px; }

.drawer-submenu-item { border-bottom: 1px solid var(--ivory-dark); }

.drawer-submenu-link {
    display: block;
    padding: 12px 24px 12px 42px;
    color: var(--charcoal-light);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
}

.drawer-submenu-link:hover {
    color: var(--emerald);
    background: var(--emerald-pale);
}

/* Drawer CTA */
.drawer-cta {
    padding: 20px 24px;
    border-top: 1px solid var(--ivory-dark);
    background: var(--ivory);
    flex-shrink: 0;
}

.drawer-cta .btn-book-now {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 0.95rem;
}

/* Drawer social */
.drawer-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px 24px;
    background: var(--ivory);
    flex-shrink: 0;
}

.drawer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--emerald-pale);
    color: var(--emerald);
    border-radius: 50%;
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.drawer-social a:hover {
    background: var(--emerald);
    color: var(--white);
    transform: scale(1.1);
}

/* ==========================================
   RESPONSIVE — SHOW/HIDE
   ========================================== */

/* Desktop: hide hamburger + drawer trigger */
@media (min-width: 993px) {
    .nav-hamburger { display: none !important; }
    .navbar-nav { display: flex !important; }
}

/* Mobile: hide desktop nav, show hamburger */
@media (max-width: 992px) {
    .navbar-nav { display: none !important; }

    .nav-hamburger { display: flex !important; }

    .navbar-inner {
        height: 72px;
        display: grid;
        grid-template-columns: 48px 1fr;
        align-items: center;
        gap: 10px;
    }
    .navbar.scrolled .navbar-inner { height: 60px; }

    .navbar {
        background: #1C1C2E !important;
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    .navbar-brand { display: none !important; }

    .navbar-cta {
        justify-content: flex-end;
        width: 100%;
        min-width: 0;
    }

    .btn-book-now { display: none; }
    .mobile-phone-cta {
        display: inline-flex;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 9px 12px;
        font-size: 0.76rem;
        min-height: 40px;
        background: transparent;
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.22);
    }

    .nav-hamburger {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.25);
    }
    .hamburger-line { background: #ffffff; }
}

@media (max-width: 480px) {
    .mobile-phone-cta {
        padding: 8px 11px;
        font-size: 0.74rem;
    }
}

/* ==========================================
   TOPBAR RESPONSIVE
   ========================================== */
@media (max-width: 992px) {
    .topbar {
        background: #ffffff;
        border-bottom: 1px solid #ececf3;
        padding: 12px 0;
        font-size: 0.76rem;
    }

    .topbar-inner {
        justify-content: center;
    }

    .topbar-left,
    .topbar-right {
        display: none !important;
    }

    .topbar-mobile-logo {
        display: inline-flex;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .topbar-mobile-logo img {
        height: 56px;
        max-width: 76vw;
    }

    .navbar-inner {
        grid-template-columns: 46px 1fr;
        gap: 8px;
    }

    .mobile-phone-cta {
        font-size: 0.7rem;
        padding: 8px 10px;
    }
}
