/**
 * CART SYSTEM STYLES
 * ==================
 * Minimal, production-ready styles for shopping cart
 */

/* ============================================
   CART CONTAINER
   ============================================ */

#cart-root {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.cart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ============================================
   CART HEADER
   ============================================ */

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.cart-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.cart-clear {
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-clear:hover {
    background: #dc2626;
}

/* ============================================
   CART ITEMS LIST
   ============================================ */

.cart-items {
    padding: 16px 24px;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.cart-item:hover {
    background: #f9fafb;
}

.cart-item:last-child {
    border-bottom: none;
}

/* ============================================
   CART ITEM - IMAGE
   ============================================ */

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cart-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 32px;
}

/* ============================================
   CART ITEM - INFO
   ============================================ */

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.4;
}

.cart-item-meta {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* ============================================
   CART ITEM - QUANTITY
   ============================================ */

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    color: #374151;
    font-size: 18px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #7C3AED;
    color: white;
}

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

.qty-input {
    width: 50px;
    height: 32px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    background: white;
}

.qty-input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Remove spinner arrows */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input[type=number] {
    -moz-appearance: textfield;
}

/* ============================================
   CART ITEM - PRICE
   ============================================ */

.cart-item-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 120px;
}

.item-unit-price {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.item-subtotal {
    font-size: 14px;
    color: #6b7280;
}

/* ============================================
   CART ITEM - REMOVE
   ============================================ */

.cart-item-remove {
    width: 40px;
    height: 40px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.05);
}

.cart-item-remove:active {
    transform: scale(0.95);
}

/* ============================================
   CART FOOTER
   ============================================ */

.cart-footer {
    padding: 24px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.cart-total {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.total-amount {
    font-size: 32px;
    font-weight: 800;
    color: #7C3AED;
    line-height: 1;
}

.btn-checkout {
    padding: 16px 32px;
    background: #7C3AED;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-checkout:hover {
    background: #6D28D9;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.btn-checkout:active {
    transform: translateY(0);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.cart-empty {
    text-align: center;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 60px 1fr;
        gap: 12px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-info {
        grid-column: 2;
    }

    .cart-item-qty {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .cart-item-price {
        grid-column: 1 / -1;
        align-items: center;
        flex-direction: row;
        gap: 12px;
    }

    .cart-item-remove {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .cart-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .cart-footer {
        flex-direction: column;
        gap: 16px;
    }

    .cart-total {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .btn-checkout {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   CART BADGE (for header)
   ============================================ */

.cart-badge,
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
    display: none;
}

/* ============================================
   ADD TO CART BUTTON FEEDBACK
   ============================================ */

.btn-cart,
.add-to-cart-btn {
    transition: all 0.3s ease;
}

.btn-cart:active,
.add-to-cart-btn:active {
    transform: scale(0.95);
}

/* ============================================
   PROMO CODE SECTION
   ============================================ */

.cart-promo-section {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #faf5ff;
}

.cart-promo-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-promo-section h3 i {
    color: #7C3AED;
}

/* Promo Input Container */
.promo-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.promo-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    transition: all 0.2s;
}

.promo-input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.promo-input::placeholder {
    color: #9ca3af;
}

.promo-apply-btn {
    padding: 12px 24px;
    background: #7C3AED;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.promo-apply-btn:hover {
    background: #6D28D9;
    transform: translateY(-1px);
}

.promo-apply-btn:active {
    transform: translateY(0);
}

/* Promo Message (Error/Success) */
.promo-message {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    display: none;
}

.promo-message.error {
    display: block;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.promo-message.success {
    display: block;
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* Applied Promo Badge */
.promo-applied {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    width: fit-content;
}

.promo-badge i {
    font-size: 16px;
}

.promo-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: auto;
}

.promo-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.promo-description {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* ============================================
   CART SUMMARY (Updated for Promo)
   ============================================ */

.cart-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.summary-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.discount-row {
    border-top: 1px dashed #e5e7eb;
    border-bottom: 1px dashed #e5e7eb;
}

.discount-value {
    color: #059669;
    font-weight: 700;
}

.total-row {
    border-top: 2px solid #e5e7eb;
    padding-top: 12px;
    margin-top: 4px;
}

.total-row .total-label {
    font-size: 16px;
    color: #111827;
    font-weight: 700;
}

.total-row .total-amount {
    font-size: 28px;
    font-weight: 800;
    color: #7C3AED;
}

/* ============================================
   RESPONSIVE - PROMO CODE
   ============================================ */

@media (max-width: 768px) {
    .promo-input-container {
        flex-direction: column;
    }

    .promo-apply-btn {
        width: 100%;
    }

    .cart-summary {
        width: 100%;
    }

    .summary-row {
        padding: 6px 0;
    }

    .total-row .total-amount {
        font-size: 24px;
    }
}