/* =========================================
   CART DRAWER STYLES - STYLE HAIRLUST
   ========================================= */

/* Overlay sombre */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
}

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

/* Cart Drawer - Panneau latéral */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -450px; /* Caché à droite */
    width: 450px;
    height: 100vh;
    background: #fff;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-drawer.is-open {
    right: -450px; /* Toujours caché mais prêt */
}

.cart-drawer.is-open.animate-in {
    right: 0; /* Slide in */
}

/* Empêcher le scroll du body quand drawer ouvert */
body.drawer-open {
    overflow: hidden;
}

/* Header du drawer */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.drawer-title {
    font-size: 18px;
    font-weight: 400;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.drawer-close:hover {
    transform: rotate(90deg);
}

/* Contenu du drawer */
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    background: #fafafa;
}

/* Items du panier */
.drawer-item {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
    transition: opacity 0.3s ease;
}

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

.drawer-item.updating {
    opacity: 0.5;
    pointer-events: none;
}

.drawer-item.removing {
    background: #fff5f5;
    opacity: 0.3;
}

/* Image produit */
.drawer-item-image {
    width: 80px;
    height: 100px;
    flex-shrink: 0;
}

.drawer-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Détails produit */
.drawer-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #000;
    text-decoration: none;
    line-height: 1.3;
}

.drawer-item-title:hover {
    text-decoration: underline;
}

.drawer-item-variant {
    font-size: 12px;
    color: #666;
}

.drawer-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

/* Quantité avec boutons +/- */
.drawer-item-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.drawer-item-quantity-wrapper label {
    font-size: 12px;
    color: #666;
    min-width: 55px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.qty-decrease,
.qty-increase {
    background: #f8f8f8;
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.qty-decrease:hover,
.qty-increase:hover {
    background: #e8e8e8;
    color: #000;
}

.qty-decrease:active,
.qty-increase:active {
    background: #ddd;
}

.drawer-item-quantity {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    background: #fff;
    -moz-appearance: textfield;
}

/* Masquer les flèches natives du input number */
.drawer-item-quantity::-webkit-outer-spin-button,
.drawer-item-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.drawer-item-quantity:focus {
    outline: none;
    background: #f9f9f9;
}

/* Bouton supprimer */
.drawer-item-remove {
    position: absolute;
    top: 20px;
    right: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color 0.2s ease;
}

.drawer-item-remove:hover {
    color: #ff4444;
}

/* Message panier vide */
.empty-cart-message {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-message p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

/* Footer du drawer */
.drawer-footer {
    border-top: 1px solid #eee;
    padding: 20px 30px 30px;
    background: #fff;
    position: sticky;
    bottom: 0;
}

/* Sous-total */
.cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.cart-subtotal .amount {
    color: #000;
}

/* Note livraison */
.shipping-note {
    font-size: 12px;
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

/* Boutons d'action */
.drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-checkout {
    display: block;
    width: 100%;
    background: #000;
    color: #fff !important;
    text-align: center;
    padding: 16px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-decoration: none;
}

.btn-checkout:hover {
    background: #333;
    color: #fff !important;
    text-decoration: none;
}

.btn-continue-shopping {
    display: block;
    width: 100%;
    background: transparent;
    color: #000;
    text-align: center;
    padding: 14px 20px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-continue-shopping:hover {
    background: #000;
    color: #fff;
}

/* Spinner de chargement */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

/* Bouton en chargement */
.single_add_to_cart_button.loading,
.add-to-cart-main.loading {
    opacity: 0.6;
    cursor: wait;
}

/* Bouton succès */
.single_add_to_cart_button.added,
.add-to-cart-main.added {
    background: #4CAF50 !important;
}

/* Animation bounce pour icône panier */
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.cart-icon.bounce {
    animation: bounce 0.6s ease;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
    
    .cart-drawer.is-open {
        right: -100%;
    }
    
    .cart-drawer.is-open.animate-in {
        right: 0;
    }
    
    .drawer-header {
        padding: 15px 20px;
    }
    
    .drawer-content {
        padding: 15px 20px;
    }
    
    .drawer-footer {
        padding: 15px 20px 20px;
    }
    
    .drawer-item-image {
        width: 60px;
        height: 75px;
    }
}

/* Animations supplémentaires */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.drawer-item {
    animation: fadeIn 0.3s ease;
}

/* Style pour les variantes (taille, couleur, etc) */
.drawer-item-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.attribute-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
}

/* Promotion/Badge dans le drawer */
.drawer-promo-badge {
    background: #ff6b6b;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
    display: inline-block;
}