/* =============================================
   Premium Mobile Sidebar Drawer v4
   Right-slide · Dark · Modern App Style
   ============================================= */

/* ── CSS Variables ── */
:root {
    --zfx-accent: var(--primary, #cba557);
    --zfx-accent-light: rgba(var(--primary-rgb, 203,165,87), 0.12);
    --zfx-accent-glow: rgba(var(--primary-rgb, 203,165,87), 0.25);
    --zfx-drawer-bg: var(--header-color, #111111);
    --zfx-drawer-text: var(--text-primary, #000000);
    --zfx-drawer-width: 280px;
    --zfx-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --zfx-ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ── Overlay ── */
.zfx-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity;
}
.zfx-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer Panel (slides from RIGHT) ── */
.zfx-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    width: var(--zfx-drawer-width);
    max-width: 85vw;
    background: var(--zfx-drawer-bg);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    will-change: transform;
}
.zfx-drawer.open {
    transform: translateX(0);
}

/* Smooth scrollbar */
.zfx-drawer::-webkit-scrollbar { width: 3px; }
.zfx-drawer::-webkit-scrollbar-track { background: transparent; }
.zfx-drawer::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 3px; }

/* ── Drawer Header ── */
.zfx-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--zfx-drawer-bg);
}
.zfx-drawer-header img {
    height: 34px;
    width: auto;
    filter: brightness(1.1);
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s 0.08s ease, transform 0.3s 0.08s ease;
    order: 1;
}
.zfx-drawer.open .zfx-drawer-header img {
    opacity: 1;
    transform: translateX(0);
}
.zfx-drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    font-size: 0.9rem;
    color: var(--zfx-drawer-text) !important;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, color 0.2s;
    order: 2;
    margin-left: auto;
}
.zfx-drawer-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--zfx-drawer-text) !important;
}
.zfx-drawer-close:active {
    transform: scale(0.9);
}

/* ── Menu Items ── */
.zfx-drawer-nav {
    flex: 1;
    padding: 0.5rem 0.6rem 1.5rem;
    list-style: none;
    margin: 0;
}
.zfx-drawer-nav li {
    opacity: 0;
    transform: translateX(16px);
}
.zfx-drawer.open .zfx-drawer-nav li {
    animation: zfxSlideIn 0.35s var(--zfx-ease-smooth) forwards;
}

/* Staggered delays */
.zfx-drawer.open .zfx-drawer-nav li:nth-child(1)  { animation-delay: 0.04s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(2)  { animation-delay: 0.07s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(3)  { animation-delay: 0.10s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(4)  { animation-delay: 0.13s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(5)  { animation-delay: 0.16s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(6)  { animation-delay: 0.19s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(7)  { animation-delay: 0.22s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(8)  { animation-delay: 0.25s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(9)  { animation-delay: 0.28s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(10) { animation-delay: 0.31s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(11) { animation-delay: 0.34s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(12) { animation-delay: 0.37s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(13) { animation-delay: 0.40s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(14) { animation-delay: 0.43s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(15) { animation-delay: 0.46s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(16) { animation-delay: 0.49s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(17) { animation-delay: 0.52s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(18) { animation-delay: 0.55s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(19) { animation-delay: 0.58s; }
.zfx-drawer.open .zfx-drawer-nav li:nth-child(20) { animation-delay: 0.61s; }

@keyframes zfxSlideIn {
    0% {
        opacity: 0;
        transform: translateX(16px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Nav Link ── */
.zfx-drawer-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    color: var(--zfx-drawer-text) !important;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: none;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Divider line under each menu item */
.zfx-drawer-nav li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.zfx-drawer-nav li:last-child {
    border-bottom: none;
}
.zfx-drawer-nav .zfx-divider + li,
.zfx-drawer-nav .zfx-section-label + li {
    border-top: none;
}

/* Icon container */
.zfx-drawer-nav a .zfx-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.95rem;
    color: #000 !important;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.zfx-drawer-nav a .zfx-icon i {
    color: inherit !important;
}

/* Hover */
.zfx-drawer-nav a:hover,
.zfx-drawer-nav a:focus-visible {
    background: rgba(0, 0, 0, 0.06);
    color: var(--zfx-drawer-text) !important;
}
.zfx-drawer-nav a:hover .zfx-icon,
.zfx-drawer-nav a:focus-visible .zfx-icon {
    background: rgba(0, 0, 0, 0.1);
    color: #000 !important;
}

/* Press */
.zfx-drawer-nav a:active {
    background: rgba(0, 0, 0, 0.08);
    transition-duration: 0.06s;
}

/* ── Active Page ── */
.zfx-drawer-nav a.active {
    background: var(--zfx-accent-light);
    color: var(--zfx-accent) !important;
    font-weight: 600;
}
.zfx-drawer-nav a.active .zfx-icon {
    background: var(--zfx-accent);
    color: #fff !important;
    box-shadow: 0 2px 6px var(--zfx-accent-glow);
}
.zfx-drawer-nav a.active .zfx-icon i {
    color: #fff !important;
}

/* ── Divider ── */
.zfx-drawer-nav .zfx-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 0.5rem 0.8rem;
    opacity: 0;
    transform: none;
}
.zfx-drawer.open .zfx-drawer-nav .zfx-divider {
    animation: zfxFadeIn 0.3s 0.15s forwards;
}

/* ── Section Label ── */
.zfx-drawer-nav .zfx-section-label {
    padding: 0.6rem 0.85rem 0.15rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: none;
}
.zfx-drawer.open .zfx-drawer-nav .zfx-section-label {
    animation: zfxFadeIn 0.3s 0.12s forwards;
}

@keyframes zfxFadeIn {
    to { opacity: 1; }
}

/* ── Drawer Footer (CTA) ── */
.zfx-drawer-footer {
    padding: 0.75rem 0.85rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--zfx-drawer-bg);
    position: sticky;
    bottom: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s 0.25s, transform 0.3s 0.25s ease;
}
.zfx-drawer.open .zfx-drawer-footer {
    opacity: 1;
    transform: translateY(0);
}
.zfx-drawer-footer .btn {
    display: block;
    width: 100%;
    padding: 0.72rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    background: var(--zfx-accent) !important;
    border: none !important;
    color: #fff !important;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 2px 10px var(--zfx-accent-glow);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
}
.zfx-drawer-footer .btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 6px var(--zfx-accent-glow);
}

/* ── Mobile: show hamburger + drawer ── */
@media (max-width: 768px) {
    /* Hide desktop nav links & CTA on mobile */
    .premium-navbar .nav-links,
    .premium-navbar .nav-cta-desktop {
        display: none !important;
    }

    /* Show hamburger */
    .premium-navbar .nav-hamburger {
        display: flex;
        z-index: 1051;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 10px;
        background: linear-gradient(135deg, var(--primary, #cba557), var(--primary-dark, #a88a3d));
        box-shadow: 0 3px 12px rgba(var(--primary-rgb, 203,165,87), 0.35);
        cursor: pointer;
        padding: 0;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.2s ease, transform 0.2s ease;
    }
    .premium-navbar .nav-hamburger:active {
        transform: scale(0.9);
        box-shadow: 0 1px 6px rgba(var(--primary-rgb, 203,165,87), 0.3);
    }
    .premium-navbar .nav-hamburger span {
        display: block;
        width: 18px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        position: absolute;
        transition: transform 0.3s ease, opacity 0.2s ease, width 0.2s ease;
    }
    .premium-navbar .nav-hamburger span:nth-child(1) { transform: translateY(-5px); }
    .premium-navbar .nav-hamburger span:nth-child(2) { transform: translateY(0); width: 14px; }
    .premium-navbar .nav-hamburger span:nth-child(3) { transform: translateY(5px); }

    /* Morph to X */
    .premium-navbar .nav-hamburger.open span:nth-child(1) {
        transform: rotate(45deg);
        width: 18px;
    }
    .premium-navbar .nav-hamburger.open span:nth-child(2) {
        opacity: 0;
        width: 0;
    }
    .premium-navbar .nav-hamburger.open span:nth-child(3) {
        transform: rotate(-45deg);
        width: 18px;
    }

    /* Hide old mobile nav elements */
    .zfx-hamburger { display: none !important; }
    .navbar-toggler { display: none !important; }
    .navbar-collapse { display: none !important; }

    /* Prevent body scroll */
    body.drawer-open {
        overflow: hidden;
        touch-action: none;
    }

    /* Hide floating buttons when drawer open */
    body.drawer-open .phone-call,
    body.drawer-open .whatsapp-chat,
    body.drawer-open .whatsapp-button,
    body.drawer-open [class*="floating"],
    body.drawer-open .tidio-chat,
    body.drawer-open #tidio-chat,
    body.drawer-open iframe[title*="chat"] {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.2s, visibility 0.2s;
    }
}

/* ── Desktop: hide drawer elements ── */
@media (min-width: 769px) {
    .zfx-drawer,
    .zfx-drawer-overlay {
        display: none !important;
    }
    .premium-navbar .nav-hamburger {
        display: none;
    }
}

/* ── Force drawer colors from admin theme ── */
.zfx-drawer,
.zfx-drawer *,
.zfx-drawer a,
.zfx-drawer span,
.zfx-drawer li,
.zfx-drawer p,
.zfx-drawer button {
    color: var(--zfx-drawer-text) !important;
}
.zfx-drawer i,
.zfx-drawer .zfx-icon i,
.zfx-drawer .zfx-drawer-close i {
    color: #000 !important;
}
.zfx-drawer .zfx-section-label {
    color: rgba(0, 0, 0, 0.4) !important;
}
.zfx-drawer-nav a.active,
.zfx-drawer-nav a.active span {
    color: var(--zfx-accent) !important;
}
.zfx-drawer-nav a.active .zfx-icon,
.zfx-drawer-nav a.active .zfx-icon i {
    color: #fff !important;
}
