/* ===== CART MOBILE - MIYOSHOP ===== */

/* Variables CSS Netflix */
:root {
    --netflix-red: #E50914;
    --netflix-dark-red: #B20710;
    --netflix-black: #000000;
    --netflix-dark-gray: #141414;
    --netflix-white: #FFFFFF;
    --netflix-gray: #808080;
    --netflix-light-gray: #333333;
}

/* ===== RÈGLES MOBILES POUR LE PANIER ===== */
@media (max-width: 768px) {
    /* ===== OVERLAY MOBILE ===== */
    .cart-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .cart-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* ===== CONTENEUR PANIER MOBILE ===== */
    .cart-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--netflix-dark-gray);
        z-index: 9999;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .cart-container.open {
        right: 0;
    }

    /* ===== HEADER PANIER MOBILE ===== */
    .cart-header {
        background: var(--netflix-black);
        padding: 15px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid var(--netflix-red);
        flex-shrink: 0;
    }

    .cart-header h2 {
        color: var(--netflix-white);
        font-size: 1.5rem;
        font-weight: bold;
        margin: 0;
    }

    .cart-close {
        background: none;
        border: none;
        color: var(--netflix-white);
        font-size: 2rem;
        cursor: pointer;
        padding: 5px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        min-height: 44px;
    }

    .cart-close:hover {
        background: var(--netflix-red);
        transform: scale(1.1);
    }

    .cart-close:active {
        transform: scale(0.95);
    }

    /* ===== CONTENU PANIER MOBILE ===== */
    .cart-content {
        flex: 1;
        overflow-y: auto;
        padding: 0;
    }

    /* Scrollbar personnalisée pour mobile */
    .cart-content::-webkit-scrollbar {
        width: 6px;
    }

    .cart-content::-webkit-scrollbar-track {
        background: var(--netflix-light-gray);
    }

    .cart-content::-webkit-scrollbar-thumb {
        background: var(--netflix-red);
        border-radius: 3px;
    }

    .cart-content::-webkit-scrollbar-thumb:hover {
        background: var(--netflix-dark-red);
    }

    /* ===== LISTE ARTICLES MOBILE ===== */
    .cart-items {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .cart-item {
        background: var(--netflix-light-gray);
        margin: 10px 15px;
        padding: 15px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        gap: 15px;
        border: 1px solid var(--netflix-gray);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .cart-item-image {
        flex-shrink: 0;
        width: 50px;
        height: 50px;
        background: var(--netflix-red);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--netflix-white);
        font-size: 1.5rem;
    }

    .cart-item-details {
        flex: 1;
        min-width: 0;
    }

    .cart-item-name {
        color: var(--netflix-white);
        font-size: 1.1rem;
        font-weight: bold;
        margin-bottom: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cart-item-price {
        color: var(--netflix-red);
        font-size: 1.2rem;
        font-weight: bold;
        margin-bottom: 10px;
    }

    .cart-item-quantity {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* ===== BOUTONS QUANTITÉ MOBILE ===== */
    .quantity-btn {
        background: var(--netflix-red);
        border: none;
        color: var(--netflix-white);
        width: 35px;
        height: 35px;
        border-radius: 50%;
        cursor: pointer;
        font-size: 1.3rem;
        font-weight: bold;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        min-height: 44px;
        touch-action: manipulation;
    }

    .quantity-btn:hover {
        background: var(--netflix-dark-red);
        transform: scale(1.1);
        box-shadow: 0 4px 10px rgba(229, 9, 20, 0.4);
    }

    .quantity-btn:active {
        transform: scale(0.95);
    }

    .quantity-btn:disabled {
        background: var(--netflix-gray);
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    .quantity-btn.plus::before {
        content: '+';
        font-weight: bold;
    }

    .quantity-btn.minus::before {
        content: '−';
        font-weight: bold;
    }

    .quantity-display {
        background: var(--netflix-light-gray);
        color: var(--netflix-white);
        padding: 8px 12px;
        border-radius: 8px;
        min-width: 40px;
        text-align: center;
        font-weight: bold;
        font-size: 1.1rem;
        border: 1px solid var(--netflix-gray);
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    /* ===== BOUTON SUPPRESSION MOBILE ===== */
    .cart-item-remove {
        background: none;
        border: none;
        color: var(--netflix-gray);
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        transition: all 0.3s ease;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        position: relative;
        min-height: 44px;
        touch-action: manipulation;
    }

    .cart-item-remove:hover {
        color: var(--netflix-red);
        background: rgba(229, 9, 20, 0.1);
        transform: scale(1.1);
    }

    .cart-item-remove:active {
        transform: scale(0.95);
    }

    .cart-item-remove::before {
        content: '🗑️';
        font-size: 1.2rem;
    }

    /* ===== PANIER VIDE MOBILE ===== */
    .cart-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        text-align: center;
        color: var(--netflix-gray);
    }

    .cart-empty i {
        font-size: 4rem;
        margin-bottom: 20px;
        color: var(--netflix-gray);
    }

    .cart-empty h3 {
        font-size: 1.5rem;
        margin-bottom: 10px;
        color: var(--netflix-white);
    }

    .cart-empty p {
        font-size: 1rem;
        line-height: 1.5;
        color: var(--netflix-gray);
    }

    /* ===== FOOTER PANIER MOBILE ===== */
    .cart-footer {
        background: var(--netflix-black);
        padding: 20px;
        border-top: 2px solid var(--netflix-red);
        flex-shrink: 0;
    }

    .cart-summary {
        margin-bottom: 20px;
    }

    .cart-subtotal,
    .cart-total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        font-size: 1rem;
    }

    .cart-subtotal {
        color: var(--netflix-gray);
        border-bottom: 1px solid var(--netflix-light-gray);
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .cart-total {
        color: var(--netflix-white);
        font-size: 1.2rem;
        font-weight: bold;
    }

    .cart-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .cart-checkout,
    .cart-continue {
        padding: 15px 20px;
        border: none;
        border-radius: 8px;
        font-size: 1.1rem;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s ease;
        min-height: 50px;
        touch-action: manipulation;
    }

    .cart-checkout {
        background: var(--netflix-red);
        color: var(--netflix-white);
    }

    .cart-checkout:hover {
        background: var(--netflix-dark-red);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
    }

    .cart-checkout:active {
        transform: translateY(0);
    }

    .cart-continue {
        background: transparent;
        color: var(--netflix-white);
        border: 2px solid var(--netflix-gray);
    }

    .cart-continue:hover {
        border-color: var(--netflix-red);
        color: var(--netflix-red);
        transform: translateY(-2px);
    }

    .cart-continue:active {
        transform: translateY(0);
    }
}

/* ===== RÈGLES POUR TRÈS PETITS ÉCRANS ===== */
@media (max-width: 480px) {
    .cart-header {
        padding: 12px 15px;
    }

    .cart-header h2 {
        font-size: 1.3rem;
    }

    .cart-close {
        font-size: 1.8rem;
        width: 35px;
        height: 35px;
    }

    .cart-item {
        margin: 8px 12px;
        padding: 12px;
        gap: 12px;
    }

    .cart-item-image {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .cart-item-name {
        font-size: 1rem;
    }

    .cart-item-price {
        font-size: 1.1rem;
    }

    .quantity-btn {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .quantity-display {
        padding: 6px 10px;
        min-width: 35px;
        font-size: 1rem;
    }

    .cart-item-remove {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    .cart-empty {
        padding: 40px 15px;
    }

    .cart-empty i {
        font-size: 3rem;
    }

    .cart-empty h3 {
        font-size: 1.3rem;
    }

    .cart-empty p {
        font-size: 0.9rem;
    }

    .cart-footer {
        padding: 15px;
    }

    .cart-subtotal,
    .cart-total {
        font-size: 0.9rem;
    }

    .cart-total {
        font-size: 1.1rem;
    }

    .cart-checkout,
    .cart-continue {
        padding: 12px 15px;
        font-size: 1rem;
        min-height: 45px;
    }
}

/* ===== ORIENTATION PAYSAGE MOBILE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .cart-container {
        width: 100%;
        height: 100vh;
    }

    .cart-content {
        max-height: calc(100vh - 200px);
    }

    .cart-item {
        margin: 8px 15px;
        padding: 12px;
    }

    .cart-footer {
        padding: 15px 20px;
    }
}

/* ===== ANIMATIONS MOBILE ===== */
@media (max-width: 768px) {
    @keyframes slideInCart {
        from { 
            transform: translateX(100%); 
            opacity: 0; 
        }
        to { 
            transform: translateX(0); 
            opacity: 1; 
        }
    }

    @keyframes slideOutCart {
        from { 
            transform: translateX(0); 
            opacity: 1; 
        }
        to { 
            transform: translateX(100%); 
            opacity: 0; 
        }
    }

    .cart-container.open {
        animation: slideInCart 0.3s ease;
    }

    .cart-container:not(.open) {
        animation: slideOutCart 0.3s ease;
    }

    /* Animation pour les articles ajoutés */
    .cart-item {
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { 
            opacity: 0; 
            transform: translateY(20px); 
        }
        to { 
            opacity: 1; 
            transform: translateY(0); 
        }
    }
}

/* ===== ACCESSIBILITÉ MOBILE ===== */
@media (max-width: 768px) {
    /* Focus visible pour l'accessibilité */
    .cart-close:focus,
    .quantity-btn:focus,
    .cart-item-remove:focus,
    .cart-checkout:focus,
    .cart-continue:focus {
        outline: 2px solid var(--netflix-red);
        outline-offset: 2px;
    }

    /* Améliorer la lisibilité */
    .cart-item {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    }

    /* États de chargement */
    .cart-container.loading {
        opacity: 0.7;
        pointer-events: none;
    }

    .cart-container.loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 30px;
        height: 30px;
        border: 3px solid var(--netflix-gray);
        border-top: 3px solid var(--netflix-red);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        transform: translate(-50%, -50%);
    }

    @keyframes spin {
        0% { transform: translate(-50%, -50%) rotate(0deg); }
        100% { transform: translate(-50%, -50%) rotate(360deg); }
    }
}
