﻿/* =========================================================
   drawer.css (THEME-AWARE + ACCENT)
   One unified drawer style for: Cart / Customer / Filters
   ========================================================= */

/* Accent: supports your theme systems (pick whatever exists) */
:root {
    --accent-color: var(--accent, var(--primary, var(--primary-color, var(--theme-accent, #2563eb))));
    /* LIGHT MODE (default) */
    --drawer-bg: rgba(255,255,255,.98);
    --drawer-text: rgba(15,23,42,.92);
    --drawer-muted: rgba(15,23,42,.62);
    --drawer-border: rgba(15,23,42,.10);
    --drawer-border-strong: rgba(15,23,42,.14);
    --drawer-surface: rgba(15,23,42,.04);
    --drawer-surface2: rgba(15,23,42,.03);
    --drawer-shadow: 0 18px 60px rgba(0,0,0,.22);
    --drawer-overlay: rgba(0,0,0,.38);
}

/* DARK MODE (support multiple possible selectors) */
body.dark,
body.theme-dark,
body.dark-mode,
html.dark body,
html[data-theme="dark"] body,
body[data-theme="dark"] {
    --drawer-bg: rgba(18,22,28,.92);
    --drawer-text: rgba(255,255,255,.92);
    --drawer-muted: rgba(255,255,255,.70);
    --drawer-border: rgba(255,255,255,.10);
    --drawer-border-strong: rgba(255,255,255,.14);
    --drawer-surface: rgba(255,255,255,.06);
    --drawer-surface2: rgba(255,255,255,.05);
    --drawer-shadow: 0 18px 60px rgba(0,0,0,.55);
    --drawer-overlay: rgba(0,0,0,.45);
}

/* =====================================================
   OVERLAY (clickable + above mobile nav)
   ===================================================== */
.app-drawer-overlay {
    position: fixed;
    inset: 0;
    background: var(--drawer-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 9000;
}

    .app-drawer-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

/* =====================================================
   DRAWER SHELL (cart-style)
   ===================================================== */
.app-drawer {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: 420px;
    max-width: calc(100vw - 20px);
    height: auto;
    border-radius: 20px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-bg);
    color: var(--drawer-text);
    box-shadow: var(--drawer-shadow);
    overflow: hidden;
    transform: translateX(110%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    z-index: 9100;
}

    .app-drawer.is-open {
        transform: translateX(0);
    }

@media (max-width: 520px) {
    .app-drawer {
        top: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }
}

body.drawer-open {
    overflow: hidden;
    touch-action: none;
}

/* =====================================================
   HEADER (accent line + premium glass)
   ===================================================== */
.drawer-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--drawer-border);
    background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.05));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

body.dark .drawer-head,
body.theme-dark .drawer-head,
body.dark-mode .drawer-head,
html.dark body .drawer-head,
html[data-theme="dark"] body .drawer-head,
body[data-theme="dark"] .drawer-head {
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
}

/* Accent glow line */
.drawer-head::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: .85;
}

.drawer-title {
    font-weight: 900;
    font-size: 15px;
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-x {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid var(--drawer-border-strong);
    background: rgba(255,255,255,.40);
    color: var(--drawer-text);
    cursor: pointer;
    transition: .15s ease;
}

    .drawer-x:hover {
        background: rgba(255,255,255,.58);
        transform: translateY(-1px);
    }

body.dark .drawer-x,
body.theme-dark .drawer-x,
body.dark-mode .drawer-x,
html.dark body .drawer-x,
html[data-theme="dark"] body .drawer-x,
body[data-theme="dark"] .drawer-x {
    background: rgba(255,255,255,.08);
}

    body.dark .drawer-x:hover,
    body.theme-dark .drawer-x:hover,
    body.dark-mode .drawer-x:hover,
    html.dark body .drawer-x:hover,
    html[data-theme="dark"] body .drawer-x:hover,
    body[data-theme="dark"] .drawer-x:hover {
        background: rgba(255,255,255,.14);
    }

/* =====================================================
   BODY / FOOTER
   ===================================================== */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 18px;
    padding-bottom: 140px; /* keep content above footer + safe area */
}

.drawer-footer {
    position: sticky;
    bottom: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--drawer-border);
    background: rgba(255,255,255,.92);
}

body.dark .drawer-footer,
body.theme-dark .drawer-footer,
body.dark-mode .drawer-footer,
html.dark body .drawer-footer,
html[data-theme="dark"] body .drawer-footer,
body[data-theme="dark"] .drawer-footer {
    background: rgba(10,14,18,.85);
}

/* =====================================================
   PRIMARY BUTTONS (accent)
   ===================================================== */
.drawer-primary-btn,
.drawer-footer button {
    width: 100%;
    height: 48px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 35%, transparent);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent-color) 24%, rgba(255,255,255,.40)), color-mix(in srgb, var(--accent-color) 12%, rgba(255,255,255,.10)));
    color: var(--drawer-text);
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
    transition: .15s ease;
}

    .drawer-primary-btn:hover,
    .drawer-footer button:hover {
        transform: translateY(-1px);
        box-shadow: 0 16px 36px rgba(0,0,0,.22);
    }

/* Dark version: richer glow */
body.dark .drawer-primary-btn,
body.dark .drawer-footer button,
body.theme-dark .drawer-primary-btn,
body.theme-dark .drawer-footer button,
body.dark-mode .drawer-primary-btn,
body.dark-mode .drawer-footer button,
html.dark body .drawer-primary-btn,
html.dark body .drawer-footer button,
html[data-theme="dark"] body .drawer-primary-btn,
html[data-theme="dark"] body .drawer-footer button,
body[data-theme="dark"] .drawer-primary-btn,
body[data-theme="dark"] .drawer-footer button {
    color: rgba(255,255,255,.92);
    box-shadow: 0 16px 40px rgba(0,0,0,.45);
}

/* =====================================================
   SECTIONS / CARDS
   ===================================================== */
.drawer-section {
    background: var(--drawer-surface);
    border: 1px solid var(--drawer-border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 10px 26px rgba(0,0,0,.10);
}

body.dark .drawer-section,
body.theme-dark .drawer-section,
body.dark-mode .drawer-section,
html.dark body .drawer-section,
html[data-theme="dark"] body .drawer-section,
body[data-theme="dark"] .drawer-section {
    box-shadow: 0 14px 34px rgba(0,0,0,.22);
}

.drawer-h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 900;
    opacity: .95;
    letter-spacing: .2px;
}

.drawer-link {
    display: block;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface2);
    color: var(--drawer-text);
    text-decoration: none;
    font-weight: 900;
    margin-top: 10px;
    transition: .15s ease;
}

    .drawer-link:hover {
        background: color-mix(in srgb, var(--accent-color) 10%, var(--drawer-surface2));
        border-color: color-mix(in srgb, var(--accent-color) 28%, var(--drawer-border));
    }

/* =====================================================
   CUSTOMER DRAWER PIECES
   ===================================================== */
.cd-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cd-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface2);
    object-fit: cover;
}

.cd-name {
    font-weight: 900;
}

.cd-sub {
    color: var(--drawer-muted);
    font-weight: 800;
    font-size: 12px;
}

.cd-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.cd-badge {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface);
    font-weight: 900;
    font-size: 12px;
}

.cd-badge-soft {
    background: color-mix(in srgb, var(--accent-color) 18%, transparent);
    border-color: color-mix(in srgb, var(--accent-color) 32%, transparent);
}

.cd-info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 12px;
    background: var(--drawer-surface2);
    border: 1px solid var(--drawer-border);
    margin-bottom: 8px;
}

.cd-k {
    color: var(--drawer-muted);
    font-weight: 900;
    font-size: 12px;
}

.cd-v {
    color: var(--drawer-text);
    font-weight: 900;
    font-size: 12px;
}

/* Nice focus ring using accent */
.app-drawer button:focus-visible,
.app-drawer a:focus-visible,
.app-drawer input:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-color) 60%, transparent);
    outline-offset: 2px;
    border-radius: 12px;
}

/* Scrollbars */
.drawer-body::-webkit-scrollbar {
    width: 10px;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.12);
    border-radius: 10px;
}

body.dark .drawer-body::-webkit-scrollbar-thumb,
body.theme-dark .drawer-body::-webkit-scrollbar-thumb,
body.dark-mode .drawer-body::-webkit-scrollbar-thumb,
html.dark body .drawer-body::-webkit-scrollbar-thumb,
html[data-theme="dark"] body .drawer-body::-webkit-scrollbar-thumb,
body[data-theme="dark"] .drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14);
}

/* =====================================================
   CUSTOMER DRAWER – HERO (match Item Info image size)
   ===================================================== */

.cd-hero {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cd-hero-img {
    width: 100%;
    height: clamp(180px, 24vh, 260px); /* ✅ big like Item Info */
    border-radius: 18px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface2);
    object-fit: cover;
    box-shadow: 0 14px 30px rgba(0,0,0,.12);
}

body.dark .cd-hero-img,
body.theme-dark .cd-hero-img,
body.dark-mode .cd-hero-img,
html.dark body .cd-hero-img,
html[data-theme="dark"] body .cd-hero-img,
body[data-theme="dark"] .cd-hero-img {
    box-shadow: 0 18px 44px rgba(0,0,0,.35);
}

.cd-hero-name {
    font-weight: 950;
    font-size: 16px;
    letter-spacing: .2px;
}

.cd-hero-address {
    color: var(--drawer-muted);
    font-weight: 850;
    font-size: 12px;
    line-height: 1.35;
}

.cd-hero-sub {
    color: var(--drawer-muted);
    font-weight: 850;
    font-size: 12px;
}

/* =====================================================
   ITEM DRAWER — make it match CUSTOMER drawer design
   (keeps bottom qty/apply footer)
   ===================================================== */

/* Give ItemDrawer a softer, “customer-like” surface */
#ItemDrawer.app-drawer {
    border-radius: 20px;
}

/* Head spacing like Customer */
#ItemDrawer .drawer-head {
    padding: 14px 14px;
}

/* Body spacing + consistent “stacked cards” feel */
#ItemDrawer .drawer-body {
    padding: 14px;
    gap: 12px;
    display: flex;
    flex-direction: column;
}

/* ---------- HERO CARD (image) ---------- */
#ItemDrawer .drawer-hero {
    height: clamp(180px, 26vh, 260px);
    border-radius: 18px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface); /* match customer */
    box-shadow: 0 10px 26px rgba(0,0,0,.10); /* match customer cards */
    padding: 12px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Inner hero frame like customer “image container” */
    #ItemDrawer .drawer-hero img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 14px;
        background: color-mix(in srgb, var(--drawer-bg) 70%, transparent);
        border: 1px solid var(--drawer-border);
        padding: 10px;
    }

/* ---------- TITLE AREA (name + subtitle) ---------- */
#ItemDrawer .drawer-name {
    font-size: 18px;
    font-weight: 950;
    letter-spacing: .2px;
    margin-top: 2px;
}

#ItemDrawer .drawer-sub {
    font-size: 12px;
    font-weight: 850;
    color: var(--drawer-muted);
    margin-bottom: 4px;
}

/* ---------- META “Customer Details” style card ---------- */
#ItemDrawer .drawer-meta {
    border-radius: 18px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface);
    box-shadow: 0 10px 26px rgba(0,0,0,.10);
    padding: 10px;
}

    /* Rows look like the customer drawer fields */
    #ItemDrawer .drawer-meta .meta-row {
        border-radius: 14px;
        background: var(--drawer-surface2);
        border: 1px solid var(--drawer-border);
        padding: 10px 12px;
    }

        #ItemDrawer .drawer-meta .meta-row + .meta-row {
            margin-top: 8px;
            border-top: none; /* remove old row separator */
        }

        /* Left labels */
        #ItemDrawer .drawer-meta .meta-row span {
            color: var(--drawer-muted);
            font-weight: 900;
            font-size: 12px;
        }

        /* Right values */
        #ItemDrawer .drawer-meta .meta-row strong {
            font-weight: 950;
            font-size: 12px;
            color: var(--drawer-text);
        }

/* ---------- PRICE BLOCK like customer “big value” ---------- */
#ItemDrawer .drawer-price {
    font-size: 26px;
    font-weight: 1000;
    letter-spacing: .2px;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Optional “status” text under price (like New) */
#ItemDrawer .drawer-desc {
    margin-top: 6px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface);
    box-shadow: 0 10px 26px rgba(0,0,0,.08);
    color: var(--drawer-text);
    font-size: 13px;
    line-height: 1.45;
}

    /* If description is empty, don’t show a big blank card */
    #ItemDrawer .drawer-desc:empty {
        display: none;
    }

/* ---------- FOOTER stays as-is, but make it match customer polish ---------- */
#ItemDrawer .drawer-footer {
    border-top: 1px solid var(--drawer-border);
    background: color-mix(in srgb, var(--drawer-bg) 92%, transparent);
}

/* Make qty bar look like customer “field rows” */
#ItemDrawer .drawer-qty-fixed .drawer-qty-control {
    border-radius: 18px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface);
    padding: 8px;
}

/* Bigger +/− buttons like your screenshot, but more “customer” */
#ItemDrawer .drawer-qty-fixed .qty-btn {
    border-radius: 14px;
    border: 1px solid var(--drawer-border-strong);
    background: color-mix(in srgb, var(--accent-color) 10%, var(--drawer-surface2));
    color: var(--drawer-text);
    font-weight: 1000;
}

    #ItemDrawer .drawer-qty-fixed .qty-btn:hover {
        border-color: color-mix(in srgb, var(--accent-color) 35%, var(--drawer-border));
        box-shadow: 0 10px 22px rgba(0,0,0,.14);
        transform: translateY(-1px);
    }

/* Qty input like a pill field */
#ItemDrawer #DrawerQty {
    border-radius: 14px;
    border: 1px solid var(--drawer-border);
    background: var(--drawer-surface2);
    height: 42px;
}

/* Apply button already nice, just match customer spacing */
#ItemDrawer #DrawerApply {
    margin-top: 10px;
    height: 52px;
    border-radius: 16px;
}

/* Mobile polish */
@media (max-width: 520px) {
    #ItemDrawer .drawer-body {
        padding: 12px;
    }

    #ItemDrawer .drawer-hero {
        height: 220px;
    }
}

/* =====================================================
   VENDOR HEADER BLOCK (MATCH CUSTOMER HEADER STYLE)
   Put this at the VERY BOTTOM of drawer.css
   ===================================================== */

#VendorDrawerTrigger.vendor-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    min-width: 220px;
}

/* match customer avatar sizing vibe */
#VendorDrawerTrigger .site-logo {
    width: 32px;
    height: 32px;
    border-radius: 999px; /* same "avatar" feel */
    object-fit: cover;
    flex: 0 0 32px;
}

/* force same typography as your customer block */
#VendorDrawerTrigger .vendor-head-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#VendorDrawerTrigger .vendor-head-name {
    font-size: 14px; /* same as customer name feel */
    line-height: 1.15;
    font-weight: 800;
    color: var(--text, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

#VendorDrawerTrigger .vendor-head-sub {
    margin-top: 2px;
    font-size: 12px; /* same as customer sub line */
    line-height: 1.15;
    font-weight: 600;
    color: var(--muted, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}
/* =====================================================
   FORCE LOGOUT BUTTON STYLE (theme-aware)
   Put this at the VERY BOTTOM of drawer.css
   ===================================================== */

#CustomerDrawer .drawer-fixed-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 14px 16px;
    background: var(--panel, rgba(255,255,255,.92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0,0,0,.08);
}

html.dark #CustomerDrawer .drawer-fixed-footer,
body.dark #CustomerDrawer .drawer-fixed-footer,
:root[data-theme="dark"] #CustomerDrawer .drawer-fixed-footer {
    background: rgba(15, 15, 18, .78);
    border-top: 1px solid rgba(255,255,255,.08);
}

#CustomerDrawer #CustomerLogoutBtn.drawer-logout-btn {
    width: 100%;
    height: 44px;
    border: 0 !important;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: .2px;
    cursor: pointer;
    outline: none;
    background: var(--primary, #ff7a18) !important;
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

    #CustomerDrawer #CustomerLogoutBtn.drawer-logout-btn:hover {
        transform: translateY(-1px);
        filter: brightness(1.03);
        box-shadow: 0 16px 34px rgba(0,0,0,.20);
    }

    #CustomerDrawer #CustomerLogoutBtn.drawer-logout-btn:active {
        transform: translateY(0);
        filter: brightness(0.98);
    }
