/* ============================================================
   THE WHITE DIGITAL — Premium Cart & Drawer System Styles
   ============================================================ */

/* Cart Count Badge in Header */
.cart-badge {
    background: var(--accent, #c9a84c);
    color: var(--black, #0a0a0a);
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--white, #ffffff);
    margin-left: 6px;
    vertical-align: middle;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.cart-badge.pulse {
    transform: scale(1.4);
}

/* Slide-out Overlay */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.75);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.4s;
    backdrop-filter: blur(8px);
}

.cart-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Premium Drawer Container */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -460px;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: var(--white, #ffffff);
    z-index: 2001;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    border-radius: 20px 0 0 20px;
    overflow: hidden;
}

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

.cart-drawer.open {
    right: 0;
}

/* Header Section */
.cart-drawer-header {
    padding: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--black, #0a0a0a);
    color: var(--white, #ffffff);
    position: relative;
}

.cart-drawer-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent, #c9a84c) 0%, transparent 100%);
}

.cart-drawer-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white, #ffffff);
    font-family: var(--font-body), sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cart-drawer-header h3 i {
    color: var(--accent, #c9a84c);
    font-size: 1.1rem;
}

.cart-drawer-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--white, #ffffff);
    font-size: 0.95rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.cart-drawer-close:hover {
    background: var(--accent, #c9a84c);
    color: var(--black, #0a0a0a);
    transform: rotate(90deg);
}

/* Custom Scrollbar & Body */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--off-white, #fafafa);
    scroll-behavior: smooth;
}

/* Custom Webkit Scrollbar */
.cart-drawer-body::-webkit-scrollbar {
    width: 6px;
}
.cart-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}
.cart-drawer-body::-webkit-scrollbar-thumb {
    background: var(--gray-300, #cccccc);
    border-radius: 10px;
}
.cart-drawer-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500, #888888);
}

/* Product Card Row */
.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--white, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md, 12px);
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), 
                box-shadow 0.25s cubic-bezier(0.25, 1, 0.5, 1),
                border-color 0.25s ease,
                opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.1));
    border-color: rgba(201, 168, 76, 0.15);
}

/* Add dynamic fade-in highlight animation when product is newly added */
.cart-item.newly-added {
    animation: newlyAddedHighlight 1.2s ease-out;
}

@keyframes newlyAddedHighlight {
    0% {
        background: rgba(201, 168, 76, 0.15);
        border-color: var(--accent, #c9a84c);
        transform: scale(0.98);
    }
    100% {
        background: var(--white, #ffffff);
        border-color: rgba(0, 0, 0, 0.05);
        transform: scale(1);
    }
}

/* Remove slide-out animation */
.cart-item.removing {
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

/* Product Image Wrappers */
.cart-item-img-wrap {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    background: var(--black, #0a0a0a);
    border: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    position: relative;
}

.cart-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.cart-item:hover .cart-item-img {
    transform: scale(1.08);
}

/* Details Column */
.cart-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 8px;
}

.cart-item-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--black, #0a0a0a);
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--font-body), sans-serif;
}

/* Delete / Trash Button */
.cart-item-remove {
    background: none;
    border: none;
    color: var(--gray-500, #888888);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    color: var(--error, #dc2626);
    transform: scale(1.15);
}

/* Price Details */
.cart-item-price-row {
    display: flex;
    align-items: center;
}

.cart-item-price {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--gray-700, #555555);
}

/* Quantity Selector & Row Subtotal */
.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.cart-qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
    background: var(--gray-100, #f5f5f5);
    padding: 2px;
}

.cart-qty-btn {
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--black, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cart-qty-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.cart-qty-btn:active {
    transform: scale(0.9);
}

.cart-qty-val {
    min-width: 24px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--black, #0a0a0a);
    user-select: none;
}

.cart-item-line-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--black, #0a0a0a);
}

/* Empty Cart State */
.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--gray-500, #888888);
    padding: 40px 24px;
}

.cart-empty-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: iconPulse 3s infinite ease-in-out;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(201, 168, 76, 0);
    }
}

.cart-empty-state i {
    font-size: 2.2rem;
    color: var(--accent, #c9a84c);
}

.cart-empty-state h4 {
    margin: 0 0 10px;
    color: var(--black, #0a0a0a);
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-head), serif;
}

.cart-empty-state p {
    font-size: 0.88rem;
    margin: 0 0 28px;
    line-height: 1.6;
    color: var(--gray-700, #555555);
}

/* Premium Drawer Footer */
.cart-drawer-footer {
    padding: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: var(--white, #ffffff);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04);
    z-index: 10;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-summary-label {
    font-size: 0.9rem;
    color: var(--gray-700, #555555);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cart-summary-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--black, #0a0a0a);
}

.cart-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-drawer-actions .btn-accent {
    padding: 16px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: 0 6px 18px rgba(201, 168, 76, 0.25);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.cart-drawer-actions .btn-accent:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(201, 168, 76, 0.4);
    transform: translateY(-1.5px);
}

.cart-drawer-actions .btn-accent:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.cart-drawer-actions .btn-outline {
    padding: 10px 18px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--gray-700, #555555);
    border-radius: var(--radius-full, 9999px);
    transition: all 0.25s ease;
}

.cart-drawer-actions .btn-outline:hover {
    border-color: var(--black, #0a0a0a);
    color: var(--black, #0a0a0a);
    background: var(--gray-100, #f5f5f5);
    transform: none;
}

/* Micro-Spinner for Button States */
.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top: 2px solid var(--black, #0a0a0a);
    border-radius: 50%;
    animation: rzp-spin 0.6s linear infinite;
}

@keyframes rzp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
