/* ==============================================
   CART DRAWER STYLES
   Unified cart styling for shop.html and item.html
   ============================================== */

/* ============================================
   NAV CART BUTTON
   ============================================ */

.nav-cart-btn {
    position: relative;
    background: #1a1a1a;
    color: var(--fluent-white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    margin: 0 8px;
}

.nav-cart-btn:hover {
    transform: scale(1.05);
    background: #333;
}

.cart-counter {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #d13438;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.cart-counter:empty,
.cart-counter[data-count="0"] {
    display: none;
}

/* ============================================
   CART DRAWER OVERLAY
   ============================================ */

.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   CART DRAWER CONTAINER
   ============================================ */

.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
}

.cart-drawer.active {
    right: 0;
}

/* ============================================
   CART DRAWER HEADER
   ============================================ */

.cart-drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.cart-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    transition: color 0.2s;
}

.cart-close-btn:hover {
    color: #1a1a1a;
}

.cart-drawer-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-drawer-header h3 span {
    font-weight: 400;
    color: #888;
}

/* ============================================
   CART ITEMS AREA
   ============================================ */

.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.cart-empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

.cart-empty-state p {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #666;
}

.cart-empty-state span {
    font-size: 13px;
}

/* ============================================
   INDIVIDUAL CART ITEM
   ============================================ */

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 12px;
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.cart-item-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.cart-item-badge.offer {
    background: #d13438;
    color: white;
}

.cart-item-badge.low-stock {
    background: #ff6b00;
    color: white;
}

.cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.cart-item-price .original {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
    margin-right: 6px;
}

/* ============================================
   CART ITEM CONTROLS
   ============================================ */

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.cart-qty-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.cart-qty-value {
    font-size: 14px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.cart-remove-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
}

.cart-remove-btn:hover {
    color: #d13438;
}

/* ============================================
   CART DRAWER FOOTER
   ============================================ */

.cart-drawer-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.cart-discount-field {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.cart-discount-field input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.cart-discount-field button {
    padding: 10px 16px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cart-discount-field button:hover {
    background: #333;
}

.cart-discount-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f5e9;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.cart-discount-applied span {
    font-size: 13px;
    color: #107c10;
    font-weight: 600;
}

.cart-discount-applied button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
}

/* ============================================
   CART TOTALS
   ============================================ */

.cart-totals {
    margin-bottom: 16px;
}

.cart-subtotal,
.cart-discount-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
}

.cart-subtotal span:last-child {
    font-weight: 700;
    font-size: 16px;
}

.cart-discount-row span:last-child {
    color: #107c10;
    font-weight: 600;
}

/* ============================================
   CHECKOUT BUTTON
   ============================================ */

.cart-checkout-btn {
    width: 100%;
    padding: 14px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.cart-checkout-btn:hover:not(:disabled) {
    background: #333;
}

.cart-checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cart-payment-methods {
    margin-top: 16px;
    text-align: center;
}

.cart-payment-methods img {
    max-width: 200px;
    opacity: 0.6;
}

/* ============================================
   CART ADD BUTTON (on product cards)
   ============================================ */

.cart-add-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: var(--fluent-black, #1a1a1a);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease;
    z-index: 10;
}

.product-card:hover .cart-add-btn {
    background: rgba(26, 26, 26, 0.95);
}

.cart-add-btn:hover {
    background: #1a1a1a;
    transform: scale(1.1);
}

.cart-add-btn.added {
    background: #107c10;
    animation: cartPop 0.3s ease;
}

/* Override any conflicting icon colors */
.cart-add-btn i {
    color: white !important;
}

@keyframes cartPop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
}

/* ============================================
   DISCOUNT CELEBRATION ANIMATION
   ============================================ */

.discount-celebration {
    animation: discountGlow 0.6s ease-out;
    position: relative;
}

.discount-celebration::before {
    content: '🎉';
    position: absolute;
    left: -20px;
    animation: confettiPop 0.6s ease-out;
}

.discount-celebration::after {
    content: '🎉';
    position: absolute;
    right: -20px;
    animation: confettiPop 0.6s ease-out 0.1s;
}

@keyframes discountGlow {
    0% {
        background: transparent;
        transform: scale(1);
    }

    30% {
        background: rgba(34, 197, 94, 0.2);
        transform: scale(1.02);
        box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
    }

    100% {
        background: transparent;
        transform: scale(1);
        box-shadow: none;
    }
}

@keyframes confettiPop {
    0% {
        opacity: 0;
        transform: scale(0) translateY(10px);
    }

    50% {
        opacity: 1;
        transform: scale(1.3) translateY(-5px);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}