/**
 * Cart Sidebar Styles - Affair3D
 * Basé sur l'implémentation de FreeTCG
 */

/* Bloquer le scroll quand le panier est ouvert */
body.cart-open {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    border-left: 1px solid var(--border-color, #e5e7eb);
    z-index: 10001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

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

.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* CRITIQUE: empêcher les clics quand caché */
}

.cart-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Permettre les clics quand visible */
}

.cart-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary, #f8f9ff);
}

.cart-sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary, #667eea);
    margin: 0;
}

.cart-sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary, #6b7280);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cart-sidebar-close:hover {
    color: var(--text-primary, #1a1a2e);
    background: rgba(0, 0, 0, 0.05);
}

.cart-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #6b7280);
}

.cart-empty-icon {
    font-size: 3rem;
    color: var(--text-light, #9ca3af);
    margin-bottom: 1rem;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    background: var(--bg-secondary, #f8f9ff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius, 12px);
    padding: 15px;
    display: flex;
    gap: 15px;
    transition: all 0.2s ease;
}

.cart-item:hover {
    border-color: var(--primary, #667eea);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: white;
}

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

.cart-item-name {
    font-weight: 600;
    color: var(--text-primary, #1a1a2e);
    font-size: 0.95rem;
    line-height: 1.3;
    margin: 0;
}

.cart-item-price {
    color: var(--primary, #667eea);
    font-weight: 600;
    font-size: 1.1rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 4px 8px;
}

.quantity-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #6b7280);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.quantity-btn:hover {
    background: var(--primary, #667eea);
    color: white;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-value {
    min-width: 30px;
    text-align: center;
    color: var(--text-primary, #1a1a2e);
    font-weight: 600;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.cart-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.cart-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f8f9ff);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.cart-total-label {
    color: var(--text-secondary, #6b7280);
    font-weight: 500;
}

.cart-total-value {
    color: var(--primary, #667eea);
    font-weight: 700;
    font-size: 1.3rem;
}

.cart-checkout-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius, 12px);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

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

/* Loading state */
.cart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary, #6b7280);
}

.cart-loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary, #667eea);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .cart-item {
        flex-direction: column;
        align-items: center;
    }

    .cart-item-image {
        width: 100%;
        height: 200px;
    }
}
