/* =================================================================== */
/*    PARTIAL: COMMERCE & SHOPPING ENGINE                              */
/*    Contains: Cart Drawer, Wishlist, Stock Badges, Qty Controls,     */
/*    Order Tracking, and Variant Selection.                           */
/* =================================================================== */

/* --- OFFCANVAS CART DRAWER (SLIDE-IN SIDEBAR) --- */

/* 1. Overlay (Dims Background) */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 199; /* Just below drawer */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* 2. The Drawer Itself */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw; /* Responsive constraint */
    height: 100%;
    background: var(--eerie-black2);
    border-left: 1px solid var(--jet);
    box-shadow: var(--shadow5);
    z-index: 200; /* Highest UI element */
    transform: translateX(100%); /* Hidden by default */
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    transform: translateX(0);
}

/* 3. Header */
.cart-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--jet);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-gradient-jet);
}

.cart-sidebar-header .h3 {
    margin: 0;
    font-size: var(--fs-4);
    color: var(--white2);
}

.cart-sidebar-header .modal-close-btn {
    position: static; /* Override absolute positioning from general modal style */
    transform: none;
    background: var(--onyx);
}

/* 4. Body (Scrollable List) */
.cart-sidebar-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
}

/* 5. Footer (Checkout) */
.cart-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--jet);
    background: var(--eerie-black2);
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: var(--fs-5);
    font-weight: 600;
    color: var(--white2);
}

.cart-total-row span:last-child {
    color: var(--orange-yellow-crayola);
}

/* 6. Individual Item Styles in Drawer */
.cart-drawer-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--border-gradient-onyx);
    border-radius: 12px;
    margin-bottom: 10px;
    position: relative;
    border: 1px solid var(--jet);
}

.cart-drawer-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--onyx);
    flex-shrink: 0;
    object-fit: cover;
}

.cart-drawer-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-drawer-title {
    font-size: var(--fs-7);
    color: var(--white2);
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.cart-drawer-meta {
    font-size: 11px;
    color: var(--light-gray70);
}

.cart-drawer-price {
    color: var(--orange-yellow-crayola);
    font-weight: 600;
}

.cart-drawer-remove {
    background: transparent;
    border: none;
    color: var(--bittersweet-shimmer);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    align-self: center;
    opacity: 0.7;
    transition: var(--transition1);
}

.cart-drawer-remove:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- PRODUCT GRID STATUS BADGES --- */
.card-badge {
    position: absolute;
    top: 12px !important;  /* Force it slightly down from edge */
    left: 12px !important; /* Force it strictly to the left edge */
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    /* High z-index ensures it sits above the image (z-index: 2) 
       and the spotlight overlay (z-index: 10) */
    z-index: 25 !important; 
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    letter-spacing: 0.8px;
    white-space: nowrap;
    width: max-content;
}

/* Red for Sold Out */
.card-badge.sold-out {
    background-color: var(--bittersweet-shimmer);
    color: var(--white1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Optional: Orange for Low Stock if you want it later */
.card-badge.low-stock {
    background-color: var(--orange-yellow-crayola);
    color: var(--eerie-black2);
}

/* Standardized Customize Badge Position */
.customize-badge {
    position: absolute;
    /* Move slightly higher so it doesn't crowd the bottom edge */
    bottom: 15px; 
    left: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 8px; /* Slightly smaller text */
    font-weight: 800;
    text-transform: uppercase;
    z-index: 25; 
    pointer-events: none;
    background: var(--orange-yellow-crayola);
    color: var(--smoky-black);
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.customize-badge ion-icon {
    font-size: 11px;
}

/* --- STOCK STATUS BADGES (Modal View) --- */
.stock-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stock-status-badge.in-stock { background: rgba(92, 184, 92, 0.15); color: #5cb85c; border: 1px solid rgba(92, 184, 92, 0.3); }
.stock-status-badge.low-stock { background: rgba(240, 173, 78, 0.15); color: #f0ad4e; border: 1px solid rgba(240, 173, 78, 0.3); }
.stock-status-badge.out-stock { background: rgba(217, 83, 79, 0.15); color: #d9534f; border: 1px solid rgba(217, 83, 79, 0.3); }

/* --- QUANTITY CONTROLS --- */
.quantity-group {
    flex-shrink: 0;
}

.qty-control {
    display: flex;
    align-items: center;
    background: var(--onyx); /* Darker background */
    border-radius: 8px;
    border: 1px solid var(--jet);
    overflow: hidden;
}

.qty-control button {
    width: 36px;
    height: 38px;
    background: transparent;
    border: none;
    color: var(--white1); /* White + / - */
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.qty-control button:hover {
    background: var(--jet);
    color: var(--orange-yellow-crayola);
}

.qty-input {
    width: 60px !important; /* Increased from 45px */
    text-align: center;
    border: none;
    background: transparent;
    color: var(--white1);
    font-size: 16px; /* Ensure text is readable */
    font-weight: 600;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield; /* Remove spinner on Firefox */
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- VARIANT SELECTOR BUTTONS --- */
.variant-selector-wrapper {
    margin-bottom: 20px;
}

.variant-label {
    display: block;
    color: var(--light-gray);
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variant-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.variant-btn {
    background: var(--onyx);
    border: 1px solid var(--jet);
    color: var(--white2);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
    font-family: inherit;
    transition: background-color 0.2s, color 0.2s, transform 0.1s, border-color 0.2s, box-shadow 0.2s;
}

.variant-btn:hover {
    background: var(--jet);
    border-color: var(--light-gray70);
    color: var(--white1);
    transform: translateY(-2px);
}

.variant-btn:active {
    transform: scale(0.95);
}

.variant-btn.active {
    background: var(--orange-yellow-crayola);
    border-color: var(--orange-yellow-crayola);
    color: var(--smoky-black);
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(255, 172, 51, 0.3);
}

.variant-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--eerie-black1);
    border-color: var(--jet);
    text-decoration: line-through;
}

/* --- VOLUME DISCOUNT MESSAGING --- */
#volume-upsell-msg {
    font-size: 12px;
    color: var(--light-gray70);
    display: none;
    align-items: center;
    gap: 5px;
}

#volume-activated-msg {
    font-size: 13px;
    color: #5cb85c;
    display: none;
    align-items: center;
    gap: 5px;
    font-weight: 700;
}

/* --- ORDER TRACKER (VISUAL TIMELINE) --- */
.order-tracker {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 30px 0; 
    position: relative;
    width: 100%;
}

.order-tracker::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--jet);
    z-index: 0;
}

.tracker-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 25%;
    text-align: center;
}

.tracker-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--eerie-black2); 
    border: 2px solid var(--jet);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    color: var(--light-gray70);
    transition: all 0.3s ease;
    margin-bottom: 8px;
    box-shadow: 0 0 0 4px var(--eerie-black2); 
}

.tracker-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--light-gray70);
    font-weight: 500;
    transition: color 0.3s ease;
}

.tracker-step.active .tracker-icon {
    border-color: var(--orange-yellow-crayola);
    color: var(--orange-yellow-crayola);
    box-shadow: 0 0 15px rgba(255, 172, 51, 0.4); 
    background: var(--bg-gradient-jet);
}

.tracker-step.active .tracker-label {
    color: var(--white2);
    font-weight: 700;
}

.tracker-step.completed .tracker-icon {
    background: var(--orange-yellow-crayola);
    border-color: var(--orange-yellow-crayola);
    color: var(--smoky-black);
}

.tracker-step.completed .tracker-label {
    color: var(--orange-yellow-crayola);
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(255, 172, 51, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(255, 172, 51, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 172, 51, 0); }
}

.tracker-step.active[data-step="crafting"] .tracker-icon {
    animation: pulse-ring 2s infinite;
}

/* --- WISHLIST / FAVORITES SYSTEM --- */
.wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 150 !important; 
    pointer-events: auto !important;
    background: rgba(0, 0, 0, 0.4);
    color: var(--white2);
    width: 40px; 
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px; 
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wishlist-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.15);
    color: white;
}

.wishlist-btn.active {
    color: var(--bittersweet-shimmer); 
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--bittersweet-shimmer);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

/* --- MOBILE STICKY COMMERCE BAR ENHANCEMENT --- */
@media (max-width: 768px) {
    .catalog-actions-row {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--eerie-black2); 
        border-top: 1px solid var(--orange-yellow-crayola); 
        padding: 15px 20px;
        margin: 0;
        z-index: 999; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.8); 
        
        display: flex;
        align-items: center;
        gap: 15px;
    }
}