/**
 * Lahdod — Quick Buy Lite Styles
 * @since 5.7.3
 *
 * Lite mode: Drawer + Overlay + Buttons + Toast (بدون Quick View/Sticky)
 */

/* =========================================================
   0) Variables (inherited from theme + local)
========================================================= */
:root {
    --qb-drawer-w: 400px;
    --qb-transition: 320ms cubic-bezier(0.4, 0, 0.2, 1);
    --qb-radius: 22px;
    --qb-radius-sm: 14px;
    --qb-surface: rgba(10, 22, 40, 0.92);
    --qb-surface-2: rgba(255, 255, 255, 0.05);
    --qb-border: rgba(0, 212, 255, 0.14);
    --qb-cyan: var(--lahdod-cyan, var(--color-cyan, #00d4ff));
    --qb-violet: var(--lahdod-violet, var(--color-violet, #7c3aed));
    --qb-text: rgba(255, 255, 255, 0.92);
    --qb-text-dim: rgba(255, 255, 255, 0.62);
    --qb-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    --qb-glow: 0 0 40px rgba(0, 212, 255, 0.12);
}

/* =========================================================
   1) OVERLAY — خلفية داكنة مشتركة (drawer + quick view)
========================================================= */
.lahdod-qb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--qb-transition), visibility var(--qb-transition);
    cursor: pointer;
}

.lahdod-qb-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Body lock when drawer/modal open */
body.lahdod-qb-drawer-open,
body.lahdod-qb-modal-open {
    overflow: hidden;
}

/* Defensive hardening: Quick View markup must never leak visually in Lite mode. */
#lahdod-qv-overlay,
#lahdod-qv-modal {
    display: none !important;
}

/* =========================================================
   2) SIDE CART DRAWER
========================================================= */
.lahdod-qb-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--qb-drawer-w);
    max-width: 92vw;
    z-index: 99999;
    background: var(--qb-surface);
    border: 1px solid var(--qb-border);
    box-shadow: var(--qb-shadow), var(--qb-glow);
    display: flex;
    flex-direction: column;
    transition: transform var(--qb-transition);
    overflow: hidden;
}

/* RTL: Drawer slides from LEFT */
html[dir="rtl"] .lahdod-qb-drawer {
    left: 0;
    right: auto;
    transform: translateX(-110%);
    border-radius: 0 var(--qb-radius) var(--qb-radius) 0;
}

html[dir="rtl"] .lahdod-qb-drawer.open {
    transform: translateX(0);
}

/* LTR: Drawer slides from RIGHT */
html:not([dir="rtl"]) .lahdod-qb-drawer {
    right: 0;
    left: auto;
    transform: translateX(110%);
    border-radius: var(--qb-radius) 0 0 var(--qb-radius);
}

html:not([dir="rtl"]) .lahdod-qb-drawer.open {
    transform: translateX(0);
}

/* ── Drawer Header ──────────────────────────────────── */
.lahdod-qb-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--qb-border);
    flex-shrink: 0;
}

.lahdod-qb-drawer-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--qb-text);
}

.lahdod-qb-drawer-close {
    background: var(--qb-surface-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--qb-text-dim);
    cursor: pointer;
    transition: all 200ms ease;
}

.lahdod-qb-drawer-close:hover {
    color: #fff;
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.1);
}

/* ── Drawer Body (scrollable) ──────────────────────── */
.lahdod-qb-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ── Empty state ───────────────────────────────────── */
.lahdod-qb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 16px;
    gap: 16px;
    color: var(--qb-text-dim);
}

.lahdod-qb-empty p {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ── Cart Items ────────────────────────────────────── */
.lahdod-qb-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lahdod-qb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--qb-surface-2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--qb-radius-sm);
    transition: opacity 300ms ease, border-color 200ms ease;
}

.lahdod-qb-item:hover {
    border-color: var(--qb-border);
}

.lahdod-qb-item-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.lahdod-qb-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.lahdod-qb-item-info {
    flex: 1;
    min-width: 0;
}

.lahdod-qb-item-name {
    display: block;
    color: var(--qb-text);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.lahdod-qb-item-name:hover {
    color: var(--qb-cyan);
}

.lahdod-qb-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.lahdod-qb-item-qty {
    color: var(--qb-text-dim);
}

.lahdod-qb-item-price {
    color: var(--qb-cyan);
    font-weight: 800;
}

.lahdod-qb-item-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 6px;
    color: var(--qb-text-dim);
    cursor: pointer;
    border-radius: 50%;
    transition: all 200ms ease;
}

.lahdod-qb-item-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ── Drawer Footer ─────────────────────────────────── */
.lahdod-qb-drawer-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--qb-border);
    background: rgba(6, 13, 26, 0.6);
}

.lahdod-qb-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--qb-text);
    margin-bottom: 14px;
}

.lahdod-qb-total-amount {
    color: var(--qb-cyan);
    font-size: 1.15rem;
}

.lahdod-qb-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* =========================================================
   3) BUTTONS — Shared
========================================================= */
.lahdod-qb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 999px;
    padding: 13px 22px;
    font-weight: 900;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 200ms ease;
    line-height: 1.4;
}

.lahdod-qb-btn-primary {
    background: linear-gradient(135deg, var(--qb-cyan), var(--qb-violet));
    color: #fff;
    box-shadow: 0 12px 28px -10px rgba(0, 212, 255, 0.35);
}

.lahdod-qb-btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 16px 34px -10px rgba(0, 212, 255, 0.4);
    color: #fff;
}

.lahdod-qb-btn-secondary {
    background: var(--qb-surface-2);
    color: var(--qb-text);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lahdod-qb-btn-secondary:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.2);
    color: #fff;
}

.lahdod-qb-btn-accent {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    box-shadow: 0 12px 28px -10px rgba(245, 158, 11, 0.3);
}

.lahdod-qb-btn-accent:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
}

.lahdod-qb-btn:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

/* =========================================================
   4) BUY NOW BUTTON — in single product page
========================================================= */
.lahdod-qb-buy-now-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 28px;
    font-weight: 900;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 12px 28px -10px rgba(245, 158, 11, 0.35);
    transition: all 200ms ease;
    width: 100%;
    margin-top: 8px;
}

.lahdod-qb-buy-now-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -10px rgba(245, 158, 11, 0.45);
}


/* =========================================================
   9) TOAST NOTIFICATIONS
========================================================= */
#lahdod-qb-toast {
    position: fixed;
    top: 90px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

html[dir="rtl"] #lahdod-qb-toast {
    right: 20px;
    left: auto;
}

html:not([dir="rtl"]) #lahdod-qb-toast {
    left: 20px;
    right: auto;
}

.lahdod-qb-toast-item {
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 300ms ease, transform 300ms ease;
    max-width: 340px;
}

.lahdod-qb-toast-item.show {
    opacity: 1;
    transform: translateY(0);
}

.lahdod-qb-toast-success {
    background: rgba(16, 185, 129, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.lahdod-qb-toast-error {
    background: rgba(239, 68, 68, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.lahdod-qb-toast-info {
    background: rgba(59, 130, 246, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* =========================================================
   10) SPINNER
========================================================= */
.lahdod-qb-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--qb-cyan);
    border-radius: 50%;
    animation: lahdod-qb-spin 700ms linear infinite;
}

@keyframes lahdod-qb-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   11) RESPONSIVE
========================================================= */

/* ── Tablet (≤ 768px) ──────────────────────────────────── */
@media (max-width: 768px) {

    .lahdod-qv-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .lahdod-qv-image img {
        max-height: 260px;
        width: 100%;
    }

    .lahdod-qv-content {
        padding: 20px;
    }

    .lahdod-qb-progress-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .lahdod-qb-progress-line {
        width: 28px;
    }

    .lahdod-qb-progress-label {
        font-size: 0.7rem;
    }
}

/* ── Mobile (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {

    :root {
        --qb-drawer-w: 100vw;
    }

    .lahdod-qb-drawer {
        border-radius: 0;
    }

    .lahdod-qb-sticky-inner {
        padding: 10px 14px;
        gap: 10px;
    }

    .lahdod-qb-sticky-thumb {
        width: 36px;
        height: 36px;
    }

    .lahdod-qb-sticky-name {
        font-size: 0.82rem;
    }

    .lahdod-qb-sticky-actions {
        flex-direction: column;
        gap: 4px;
    }

    .lahdod-qb-sticky-actions .lahdod-qb-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .lahdod-qb-progress {
        gap: 0;
        padding: 14px 8px;
    }

    .lahdod-qb-progress-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .lahdod-qb-progress-line {
        width: 18px;
        margin-bottom: 18px;
    }

    .lahdod-qb-progress-label {
        font-size: 0.65rem;
    }

    .lahdod-qb-buy-now-btn {
        font-size: 0.9rem;
        padding: 12px 20px;
    }

    #lahdod-qb-toast {
        right: 10px;
        left: 10px;
    }

    html[dir="rtl"] #lahdod-qb-toast {
        right: 10px;
        left: 10px;
    }

    .lahdod-qb-toast-item {
        max-width: 100%;
    }
}
