/* ===================================
   Styles du Panier de Commande - Responsive
   =================================== */

/* Conteneur principal du panier */
.shopping-cart-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

/* Bouton de basculement du panier */
.cart-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.cart-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.cart-toggle-btn:active {
    transform: scale(0.95);
}

/* Badge du nombre d'articles */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Panneau du panier - Desktop */
.cart-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* En-tête du panier */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cart-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

/* Conteneur des articles */
.cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 100px;
}

.empty-cart-msg {
    text-align: center;
    color: #999;
    padding: 30px 20px;
    font-size: 14px;
}

/* Article du panier */
.cart-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
    background: #fafafa;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cart-item:hover {
    background: #f5f5f5;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-info h5 {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.item-price {
    margin: 0;
    font-size: 12px;
    color: #666;
}

/* Contrôles de quantité */
.item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-direction: column;
    flex-shrink: 0;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.qty-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.qty-display {
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.remove-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background 0.2s ease;
    padding: 0;
}

.remove-btn:hover {
    background: #ff5252;
}

/* Total de l'article */
.item-total {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* Résumé du panier */
.cart-summary {
    padding: 12px 16px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
    color: #666;
}

.summary-row.total {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
    margin-top: 8px;
}

/* Actions du panier */
.cart-actions {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.btn-outline-danger {
    color: #ff6b6b;
    border-color: #ff6b6b;
    background: white;
    font-size: 12px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    border: 1px solid #ff6b6b;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
}

.btn-outline-danger:hover {
    background: #ff6b6b;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    width: 100%;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* Notification */
.cart-notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 999;
}

.cart-notification.show {
    opacity: 1;
}

/* Boutons d'ajout au panier */
.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

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

/* Scrollbar personnalisée pour le panier */
.cart-items-container::-webkit-scrollbar {
    width: 6px;
}

.cart-items-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cart-items-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.cart-items-container::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* ===================================
   RESPONSIVE DESIGN - TABLETTE
   =================================== */

@media (max-width: 1024px) {
    .cart-panel {
        width: 340px;
        max-height: 550px;
    }

    .cart-toggle-btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

/* ===================================
   RESPONSIVE DESIGN - MOBILE (768px et moins)
   =================================== */

@media (max-width: 768px) {
    .shopping-cart-container {
        bottom: 15px;
        right: 15px;
    }

    .cart-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .cart-count {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    /* Panneau du panier en mode tablette */
    .cart-panel {
        position: fixed;
        bottom: 70px;
        right: 15px;
        left: auto;
        width: 90vw;
        max-width: 350px;
        max-height: 70vh;
        border-radius: 12px;
        animation: slideUp 0.3s ease;
    }

    .cart-header h3 {
        font-size: 16px;
    }

    .cart-items-container {
        padding: 10px;
    }

    .cart-item {
        padding: 10px;
        gap: 8px;
    }

    .item-info h5 {
        font-size: 12px;
    }

    .item-price {
        font-size: 11px;
    }

    .item-total {
        font-size: 11px;
        min-width: 45px;
    }

    .summary-row {
        font-size: 12px;
    }

    .summary-row.total {
        font-size: 14px;
    }

    .cart-actions {
        padding: 10px 12px;
    }

    .btn-outline-danger,
    .btn-success {
        font-size: 11px;
        padding: 8px 10px;
    }

    .cart-notification {
        bottom: 80px;
        right: 15px;
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* ===================================
   RESPONSIVE DESIGN - PETIT MOBILE (480px et moins)
   =================================== */

@media (max-width: 480px) {
    .shopping-cart-container {
        bottom: 12px;
        right: 12px;
    }

    .cart-toggle-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .cart-count {
        width: 22px;
        height: 22px;
        font-size: 10px;
        top: -6px;
        right: -6px;
    }

    /* Panneau du panier en mode plein écran mobile */
    .cart-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        animation: slideUpMobile 0.3s ease;
        display: flex;
        flex-direction: column;
    }

    .cart-header {
        padding: 14px 16px;
        border-radius: 16px 16px 0 0;
    }

    .cart-header h3 {
        font-size: 16px;
    }

    .cart-items-container {
        padding: 12px;
        max-height: calc(85vh - 180px);
        overflow-y: auto;
    }

    .cart-item {
        padding: 12px;
        gap: 10px;
        margin-bottom: 8px;
    }

    .item-info h5 {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .item-price {
        font-size: 12px;
    }

    .item-controls {
        gap: 8px;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .qty-display {
        font-size: 13px;
        min-width: 24px;
    }

    .remove-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .item-total {
        font-size: 13px;
        min-width: 55px;
        font-weight: 700;
    }

    .cart-summary {
        padding: 14px 16px;
    }

    .summary-row {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .summary-row.total {
        font-size: 16px;
        padding-top: 10px;
        margin-top: 10px;
    }

    .cart-actions {
        padding: 14px 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .btn-outline-danger,
    .btn-success {
        font-size: 14px;
        padding: 12px 14px;
        border-radius: 8px;
        font-weight: 600;
        width: 100%;
    }

    .btn-outline-danger {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .btn-success {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .cart-notification {
        bottom: 90px;
        right: 12px;
        left: 12px;
        font-size: 14px;
        padding: 12px 16px;
        text-align: center;
    }

    /* Amélioration de la scrollbar sur mobile */
    .cart-items-container::-webkit-scrollbar {
        width: 4px;
    }

    .cart-items-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .cart-items-container::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }
}

/* ===================================
   RESPONSIVE DESIGN - TRÈS PETIT MOBILE (360px et moins)
   =================================== */

@media (max-width: 360px) {
    .cart-toggle-btn {
        width: 46px;
        height: 46px;
        font-size: 16px;
    }

    .cart-header h3 {
        font-size: 15px;
    }

    .item-info h5 {
        font-size: 12px;
    }

    .item-price {
        font-size: 11px;
    }

    .summary-row {
        font-size: 12px;
    }

    .summary-row.total {
        font-size: 15px;
    }

    .btn-outline-danger,
    .btn-success {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* ===================================
   AMÉLIORATIONS TACTILES POUR MOBILE
   =================================== */

@media (hover: none) and (pointer: coarse) {
    /* Augmenter la taille des zones tactiles */
    .qty-btn,
    .remove-btn {
        min-width: 32px;
        min-height: 32px;
    }

    /* Améliorer le feedback tactile */
    .btn-primary,
    .btn-success,
    .btn-outline-danger {
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Désactiver le hover sur mobile */
    .cart-item:hover {
        background: #fafafa;
    }

    .qty-btn:hover {
        background: white;
        color: #333;
    }

    .btn-primary:hover,
    .btn-success:hover {
        transform: none;
    }
}
