/* Styles pour le composant panier dans le header */

.cart-component {
    position: relative;
    display: inline-block;
}

.cart-button-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-button {
    position: relative;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    border: 2px solid white;
}

/* Bouton de toggle pour le popup */
.cart-toggle-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-toggle-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.cart-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.cart-toggle-btn.active i {
    transform: rotate(180deg);
}

/* Résumé du panier toujours visible */
.cart-summary-always {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 12px;
    color: #6c757d;
}

.cart-summary-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cart-total-items {
    font-weight: 500;
}

.cart-total-price {
    font-weight: 600;
    color: #28a745;
}

/* Popup du panier */
.cart-popup {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    margin-top: 8px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.cart-popup.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.cart-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.cart-popup-header {
    background: #f8f9fa;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-popup-header h6 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.cart-close-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-close-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.cart-close-btn i {
    font-size: 14px;
}

.cart-items-preview {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.cart-item-preview {
    padding: 8px 16px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.cart-item-preview:hover {
    background-color: #f8f9fa;
}

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

.cart-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
}

.cart-item-quantity {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.cart-item-price {
    font-weight: 600;
    color: #28a745;
}

.cart-more-items {
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.cart-empty {
    padding: 20px 16px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.cart-popup-footer {
    background: #f8f9fa;
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-total {
    font-size: 14px;
    color: #333;
}

.cart-popup-footer .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Animation d'apparition */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .cart-popup {
        width: 280px;
        right: -50px;
    }
    
    .cart-popup::before {
        right: 50px;
    }
    
    .cart-summary-always {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .cart-summary-info {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .cart-popup {
        width: 260px;
        right: -80px;
    }
    
    .cart-popup::before {
        right: 80px;
    }
    
    .cart-button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .cart-count {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    
    .cart-button-container {
        flex-direction: column;
        gap: 4px;
    }
}

/* Styles pour les boutons d'ajout au panier */
.add-to-cart-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.add-to-cart-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

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

.add-to-cart-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.add-to-cart-btn .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification de succès */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-notification.show {
    transform: translateX(0);
}

.cart-notification.success {
    background: #28a745;
}

.cart-notification.error {
    background: #dc3545;
}
