/* sticky-cart.css */

/* Container principal - position côté droit */
.sticky-cart-container {
    position: fixed;
    top: 50%;
    right: -380px; /* Caché par défaut */
    transform: translateY(-50%);
    width: 380px;
    height: auto;
    max-height: 90vh;
    z-index: 1040;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-cart-container.active {
    right: 0;
}

/* Wrapper */
.sticky-cart-wrapper {
    display: flex;
    height: 100%;
}

/* Onglet toggle vertical */
.cart-toggle-tab {
    position: absolute;
    left: -48px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 120px;
    background: linear-gradient(135deg, #4a4a4a 0%, #2d2d2d 100%);
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -4px 0 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.cart-toggle-tab:hover {
    background: linear-gradient(135deg, #5a5a5a 0%, #3d3d3d 100%);
    transform: translateY(-50%) translateX(-3px);
}

.tab-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: white;
}

.tab-content i {
    font-size: 24px;
}

.cart-count-bubble {
    position: absolute;
    top: 15px;
    right: 8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tab-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Panneau principal */
.cart-panel {
    width: 100%;
    background: #ffffff;
    box-shadow: -8px 0 24px rgba(0,0,0,0.15);
    border-radius: 12px 0 0 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.cart-header {
    background: linear-gradient(135deg, #efb60e 0%, #eba708 100%);
    padding: 20px;
    border-bottom: 1px solid #ffb300;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    margin: 0;
    font-size: 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight:bold;
}

.cart-title i {
    color: #ffffff;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #ffffff;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    color: #f0f0f0;
    transform: rotate(90deg);
}

/* Corps du panier */
.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

/* Section items */
.cart-items-section {
    margin-bottom: 20px;
}

.cart-section-title {
    margin: 0 0 15px;
    font-size: 14px;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-items {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Scrollbar personnalisée */
.cart-items::-webkit-scrollbar,
.cart-body::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track,
.cart-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb,
.cart-body::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #6c757d, #495057);
    border-radius: 3px;
}

/* Item individuel */
.cart-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.cart-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateX(-3px);
}

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

.item-name {
    font-size: 14px;
    color: #2d2d2d;
    font-weight: 500;
}

.item-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
}

.item-qty {
    color: #ffffff;
    background: #6c757d;
    padding: 2px 8px;
    border-radius: 12px;
}

.item-price-details {
    text-align: right;
}

.item-price {
    font-weight: 600;
    color: #495057;
    display: block;
}

.item-fee {
    font-size: 11px;
    color: #6c757d;
    display: block;
    margin-top: 2px;
}

/* Panier vide */
.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: #adb5bd;
}

.empty-cart i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Résumé */
.cart-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 100%);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #6c757d;
}

.summary-line:last-child {
    margin-bottom: 0;
}

.summary-total {
    font-size: 18px;
    font-weight: bold;
    color: #2d2d2d;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #dee2e6;
}

.summary-label {
    font-weight: 500;
}

.summary-value {
    font-weight: 600;
}

/* Footer */
.cart-footer {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Boutons */
.cart-footer .btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.btn-secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Mobile - ajustements */
@media (max-width: 768px) {
    .sticky-cart-container {
        width: 320px;
        right: -320px;
        max-height: 80vh;
    }
    
    .cart-toggle-tab {
        width: 40px;
        left: -40px;
        height: 100px;
    }
    
    .tab-content i {
        font-size: 20px;
    }
    
    .cart-count-bubble {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .cart-items {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .sticky-cart-container {
        width: 100vw;
        right: -100vw;
        top: auto;
        bottom: 0;
        transform: none;
        height: 75vh; /* 3/4 de l'écran */
        max-height: 75vh;
    }
    
    .cart-panel {
        border-radius: 12px 12px 0 0; /* Coins arrondis en haut */
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .cart-toggle-tab {
        top: 20px;
        transform: translateY(0);
        left: auto;
        right: 20px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #4a4a4a 0%, #2d2d2d 100%);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    
    .tab-text {
        display: none;
    }
    
    .cart-body {
        overflow-y: auto;
        flex: 1;
        padding: 15px;
    }
    
    .cart-items {
        max-height: none; /* Pas de limite fixe, le parent gère le scroll */
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.cart-count-bubble.pulse {
    animation: pulse 0.6s ease-in-out;
}

/* Animation d'ajout d'item */
@keyframes itemAdded {
    0% { 
        opacity: 0;
        transform: translateX(20px);
    }
    100% { 
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item.new-item {
    animation: itemAdded 0.3s ease-out;
}