/* ── Header cart button ── */
.cart-btn {
    background: var(--card-dark);
    border: 1px solid var(--border);
    color: var(--text-white);
    padding: 8px 14px;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-btn:hover { border-color: var(--accent); }

.cart-count {
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
}

/* ── Backdrop ── */
.cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.cart-backdrop.visible { opacity: 1; pointer-events: auto; }

/* ── Drawer ── */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: #111;
    border-left: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
}

.cart-drawer.open { transform: translateX(0); }

@media (max-width: 480px) { .cart-drawer { width: 100%; } }

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

.cart-drawer-title { font-size: 17px; font-weight: 700; margin: 0; }

.cart-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
}

.cart-drawer-close:hover { color: var(--text-white); background: rgba(255,255,255,0.06); }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.cart-drawer-body::-webkit-scrollbar       { width: 4px; }
.cart-drawer-body::-webkit-scrollbar-track { background: transparent; }
.cart-drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cart-drawer-footer {
    padding: 16px 24px 28px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Items list ── */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.cart-item-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.cart-item-thumb img { width: 100%; height: 100%; object-fit: cover; }

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

.cart-item-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 3px; }

.cart-item-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.cart-item-remove:hover { color: var(--error); background: rgba(239,68,68,0.1); }

/* ── Light theme overrides ── */
body.light .cart-btn {
    background: #fff;
    border-color: #d1d5db;
    color: #111;
}

body.light .cart-drawer {
    background: #fff;
    border-left-color: #e5e7eb;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.12);
}

body.light .cart-drawer-header { border-bottom-color: #e5e7eb; }
body.light .cart-drawer-footer { border-top-color: #e5e7eb; }

body.light .cart-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}

body.light .cart-item-thumb { background: #e5e7eb; }

body.light .cart-drawer-close       { color: #6b7280; }
body.light .cart-drawer-close:hover { color: #111; background: rgba(0,0,0,0.06); }

body.light .cart-item-remove:hover  { background: rgba(239,68,68,0.08); }

/* ── Mobile FAB (floating cart button) ── */
@media (max-width: 768px) {
    #cartBtn:not(.hidden) {
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 500;
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
        border-radius: 50px;
        padding: 13px 22px;
        font-size: 15px;
        box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45);
    }

    /* Push toast above FAB so they don't overlap */
    .toast {
        bottom: 88px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }
}

/* ── Info note ── */
.cart-note {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 16px;
    padding: 12px 16px;
    background: rgba(139,92,246,0.08);
    border-radius: 10px;
    border-left: 3px solid var(--accent);
}
