/* ── Cart & Checkout ───────────────────────────────────────────── */

/* Cart icon in header */
.cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.cart-btn:hover { background: #f3f4f6; color: #dd3d31; }
.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #dd3d31;
    color: #fff;
    border-radius: 9px;
    font-size: .65rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Cart layout */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}
.cart-loading {
    grid-column: 1/-1;
    padding: 3rem;
    text-align: center;
    color: #6b7280;
}

/* Empty state */
.cart-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 4rem 2rem;
}
.cart-empty-icon {
    width: 96px;
    height: 96px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #9ca3af;
}
.cart-empty h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.cart-empty p  { color: #6b7280; margin-bottom: 1.5rem; }

/* Items column */
.cart-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.cart-items-header h2 { font-size: 1.1rem; font-weight: 700; }

/* Cart item */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}
.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title {
    font-weight: 600;
    color: #0f1f38;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cart-item-title:hover { color: #dd3d31; }
.cart-item-price { font-size: .85rem; color: #6b7280; margin-top: .25rem; }

/* Cart item actions */
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    flex-shrink: 0;
}
.qty-control {
    display: flex;
    align-items: center;
    gap: .25rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}
.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.qty-btn:hover { background: #f3f4f6; }
.qty-val {
    min-width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: .9rem;
}
.cart-item-total {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.cart-item-remove {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
    transition: color .15s;
}
.cart-item-remove:hover { color: #dc2626; }

/* Summary */
.cart-summary {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.5rem;
    position: sticky;
    top: 80px;
}
.cart-summary h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: .5rem 0;
    font-size: .9rem;
    border-bottom: 1px solid #f3f4f6;
}
.cart-summary-row:last-of-type { border-bottom: none; }
.cart-summary-discount { color: #16a34a; }
.cart-summary-total {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f1f38;
}
.cart-promo { margin-top: 1rem; }
.cart-promo-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: .5rem .75rem;
    font-size: .875rem;
    color: #166534;
}
.btn-full { width: 100%; }

/* ── Cart slide-in drawer ──────────────────────────────────────── */

.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(2px);
    z-index: 900;
    animation: fadeIn .15s ease;
}
.cart-drawer-overlay.hidden { display: none; }

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 92vw;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 40px rgba(0,0,0,.15);
    z-index: 910;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.cart-drawer-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}
.cart-drawer-close {
    width: 32px; height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background .15s, color .15s;
}
.cart-drawer-close:hover { background: #e5e7eb; color: #111; }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.cart-drawer-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fafafa;
}

/* Added confirmation */
.cart-drawer-added {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    margin-bottom: 1rem;
    color: #15803d;
    font-weight: 600;
    font-size: .9rem;
}
.cart-drawer-added-check {
    width: 28px; height: 28px;
    background: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

/* Featured added product */
.cart-drawer-product {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding-bottom: 1rem;
}
.cart-drawer-product img {
    width: 80px; height: 80px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .25rem;
    background: #fff;
    flex-shrink: 0;
}
.cart-drawer-product-info { flex: 1; min-width: 0; }
.cart-drawer-product-title {
    font-weight: 600;
    font-size: .9rem;
    color: #111;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cart-drawer-product-title:hover { color: #dd3d31; }
.cart-drawer-product-price { font-weight: 700; font-size: .95rem; margin-top: .25rem; }
.cart-drawer-product-qty { font-size: .8rem; color: #6b7280; margin-top: .15rem; }

/* Divider */
.cart-drawer-divider {
    height: 1px;
    background: #e5e7eb;
    margin: .75rem 0;
}
.cart-drawer-others-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    margin-bottom: .75rem;
}

/* Other items in cart */
.cart-drawer-item {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .5rem 0;
}
.cart-drawer-item img {
    width: 48px; height: 48px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: .15rem;
    background: #fff;
    flex-shrink: 0;
}
.cart-drawer-item-info { flex: 1; min-width: 0; }
.cart-drawer-item-title {
    font-size: .8rem;
    font-weight: 500;
    color: #374151;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cart-drawer-item-price { font-size: .8rem; font-weight: 600; color: #111; }

/* Footer */
.cart-drawer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1rem;
}
.cart-drawer-total strong { font-size: 1.15rem; }
.cart-drawer-checkout {
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
}
.cart-drawer-continue {
    margin-top: .5rem;
    justify-content: center;
    font-size: .875rem;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Responsive */
@media (max-width: 768px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-item { flex-wrap: wrap; }
    .cart-item-actions { flex-direction: row; align-items: center; flex: 1; justify-content: space-between; }
}
