/* ============================================
   UNIFIED SHOPPING CART STYLES
   Works with both Light and Dark themes
   Supports Full Mode (Stripe+PayPal) and Simple Mode (Single Checkout)
   ============================================ */

/* ============================================
   CART MODAL BASE
   ============================================ */
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: flex-end;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-modal.active {
    display: flex;
    opacity: 1;
}

/* ============================================
   CART CONTENT CONTAINER
   ============================================ */
.cart-content {
    background: var(--bg-primary);
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-modal.active .cart-content {
    transform: translateX(0);
}

body.dark-theme .cart-content {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

body.light-theme .cart-content {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

/* ============================================
   CART HEADER
   ============================================ */
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.cart-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ============================================
   CART ITEMS CONTAINER
   ============================================ */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-items::-webkit-scrollbar {
    width: 8px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================
   EMPTY CART STATE
   ============================================ */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.cart-empty svg {
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.cart-empty p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.continue-shopping-btn {
    background: var(--aurum-copper);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

body.light-theme .continue-shopping-btn {
    background: linear-gradient(to right, var(--yellow-500), var(--amber-600));
}

.continue-shopping-btn:hover {
    background: var(--aurum-copper-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(182, 123, 76, 0.3);
}

body.light-theme .continue-shopping-btn:hover {
    background: linear-gradient(to right, var(--yellow-600), var(--amber-700));
}

/* ============================================
   CART ITEM
   ============================================ */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

body.dark-theme .cart-item {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.light-theme .cart-item {
    border-color: rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 0.5rem;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-item-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.cart-item-price {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--aurum-copper);
}

body.light-theme .cart-item-price {
    color: var(--amber-600);
}

.cart-item-category {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   CART ITEM CONTROLS
   ============================================ */
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
}

body.dark-theme .quantity-controls {
    border-color: rgba(255, 255, 255, 0.1);
}

body.light-theme .quantity-controls {
    border-color: rgba(0, 0, 0, 0.1);
}

.quantity-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.375rem;
    color: var(--text-primary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--aurum-copper);
}

body.light-theme .quantity-btn:hover:not(:disabled) {
    color: var(--amber-600);
}

.quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.25rem;
}

.quantity-input:focus {
    outline: none;
}

/* Remove Button */
.remove-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

body.light-theme .remove-btn:hover {
    background: rgba(239, 68, 68, 0.05);
}

.cart-item-subtotal {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ============================================
   CART FOOTER
   ============================================ */
.cart-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    background: var(--bg-secondary);
}

/* Cart Summary */
.cart-summary {
    margin-bottom: 1.5rem;
}

.cart-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.cart-summary-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.cart-total span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

#cart-total-price {
    color: var(--aurum-copper);
    font-size: 1.5rem;
}

body.light-theme #cart-total-price {
    color: var(--amber-600);
}

/* ============================================
   CART ACTIONS (BUTTONS)
   ============================================ */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkout-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Stripe Button */
.stripe-btn {
    background: var(--aurum-copper);
    color: white;
}

body.light-theme .stripe-btn {
    background: linear-gradient(to right, var(--yellow-500), var(--amber-600));
}

.stripe-btn:hover {
    background: var(--aurum-copper-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(182, 123, 76, 0.3);
}

body.light-theme .stripe-btn:hover {
    background: linear-gradient(to right, var(--yellow-600), var(--amber-700));
}

/* PayPal Button */
.paypal-btn {
    background: #0070ba;
    color: white;
}

.paypal-btn:hover {
    background: #005a92;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 112, 186, 0.3);
}

/* Clear Cart Button */
.clear-cart-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.clear-cart-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: #ef4444;
}

/* ============================================
   CART COUNT BADGE
   ============================================ */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   CART NOTIFICATIONS
   ============================================ */
.cart-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 10001;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
}

.cart-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.cart-notification-success {
    background: #10b981;
    color: white;
}

.cart-notification-error {
    background: #ef4444;
    color: white;
}

.cart-notification-warning {
    background: #f59e0b;
    color: white;
}

.cart-notification-info {
    background: var(--aurum-copper);
    color: white;
}

body.light-theme .cart-notification-info {
    background: var(--amber-600);
}

/* ============================================
   MODAL STYLES (for address selection)
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

body.light-theme .modal-content {
    background: white;
}

body.dark-theme .modal-content {
    background: var(--aurum-dark);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.info-message {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #3b82f6;
}

body.light-theme .info-message {
    background: rgba(59, 130, 246, 0.05);
}

/* Address Selection List */
.address-selection-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.address-selection-item {
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.address-selection-item:hover {
    border-color: var(--aurum-copper);
}

body.light-theme .address-selection-item:hover {
    border-color: var(--amber-500);
}

.address-selection-item.default {
    border-color: var(--aurum-copper);
}

body.light-theme .address-selection-item.default {
    border-color: var(--amber-500);
}

.address-selection-item input[type="radio"] {
    display: none;
}

.address-selection-item label {
    cursor: pointer;
}

.address-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.badge-default {
    background: var(--aurum-copper);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

body.light-theme .badge-default {
    background: var(--amber-500);
}

.address-selection-body p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn-primary {
    background: var(--aurum-copper);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

body.light-theme .btn-primary {
    background: var(--amber-500);
}

.btn-primary:hover {
    background: var(--aurum-copper-light);
}

body.light-theme .btn-primary:hover {
    background: var(--amber-600);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.875rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--bg-secondary);

    color: var(--text-primary);
}

.btn-add-address {
    width: 100%;
    justify-content: center;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 640px) {
    .cart-content {
        max-width: 100%;
    }

    .cart-header {
        padding: 1rem;
    }

    .cart-header h2 {
        font-size: 1.25rem;
    }

    .cart-items {
        padding: 0.75rem;
    }

    .cart-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cart-item-image {
        width: 100%;
        height: 200px;
    }

    .cart-item-controls {
        flex-wrap: wrap;
    }

    .remove-btn {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .cart-footer {
        padding: 1rem;
    }

    .cart-notification {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */
.cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .cart-modal,
    .cart-content,
    .cart-notification,
    .checkout-btn,
    .cart-item {
        transition: none;
        animation: none;
    }
}

.cart-modal:focus,
.modal-overlay:focus {
    outline: none;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .cart-modal,
    .cart-notification {
        display: none;
    }
}