/**
 * CART MODAL CYBERPUNK - LA FENÊTRE MODALE LA PLUS FOLLE
 * Des effets spéciaux jamais vus pour le panier !
 */

/* Overlay avec effet matrix */
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
}

.cart-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Matrix rain background effect */
.cart-modal-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 245, 255, 0.03) 2px,
            rgba(0, 245, 255, 0.03) 4px
        );
    animation: matrixRain 20s linear infinite;
}

@keyframes matrixRain {
    0% { transform: translateY(0); }
    100% { transform: translateY(100%); }
}

/* Modal container avec effet holographique */
.cart-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 960px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(26, 26, 26, 0.95) 50%, rgba(10, 10, 10, 0.95) 100%);
    border: 2px solid var(--neon-cyan);
    box-shadow: 
        0 0 50px rgba(0, 245, 255, 0.5),
        inset 0 0 50px rgba(0, 245, 255, 0.1),
        0 0 100px rgba(189, 0, 255, 0.3);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    clip-path: polygon(
        0 20px, 20px 0,
        calc(100% - 20px) 0, 100% 20px,
        100% calc(100% - 20px), calc(100% - 20px) 100%,
        20px 100%, 0 calc(100% - 20px)
    );
    overflow: hidden;
}

.cart-modal-overlay.active .cart-modal {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Effet de scan holographique */
.cart-modal::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 245, 255, 0.1) 50%,
        transparent 100%
    );
    animation: hologramScan 3s linear infinite;
}

@keyframes hologramScan {
    0% { top: -100%; }
    100% { top: 100%; }
}

/* Header du modal */
.cart-modal-header {
    padding: 30px;
    background: linear-gradient(90deg, rgba(189, 0, 255, 0.2) 0%, rgba(0, 245, 255, 0.2) 50%, rgba(189, 0, 255, 0.2) 100%);
    border-bottom: 2px solid var(--neon-purple);
    position: relative;
    overflow: hidden;
}

/* Titre avec effet glitch épique */
.cart-modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    font-weight: 900;
    color: var(--neon-cyan);
    text-transform: uppercase;
    text-align: center;
    margin: 0;
    position: relative;
    text-shadow: 
        0 0 10px var(--neon-cyan),
        0 0 20px var(--neon-cyan),
        0 0 40px var(--neon-cyan);
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { 
        text-shadow: 
            0 0 10px var(--neon-cyan),
            0 0 20px var(--neon-cyan),
            0 0 40px var(--neon-cyan);
    }
    50% { 
        text-shadow: 
            0 0 20px var(--neon-cyan),
            0 0 40px var(--neon-cyan),
            0 0 80px var(--neon-cyan);
    }
}

/* Effet glitch sur le titre */
.cart-modal-title::before,
.cart-modal-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cart-modal-title::before {
    animation: glitchTitle1 0.5s infinite;
    color: var(--neon-pink);
    z-index: -1;
}

.cart-modal-title::after {
    animation: glitchTitle2 0.5s infinite;
    color: var(--neon-green);
    z-index: -2;
}

@keyframes glitchTitle1 {
    0%, 100% { 
        clip-path: inset(0 0 0 0); 
        transform: translate(0);
    }
    20% { 
        clip-path: inset(20% 0 60% 0); 
        transform: translate(-2px, 2px);
    }
    40% { 
        clip-path: inset(50% 0 20% 0); 
        transform: translate(2px, -2px);
    }
    60% { 
        clip-path: inset(10% 0 80% 0); 
        transform: translate(-1px, 1px);
    }
    80% { 
        clip-path: inset(80% 0 10% 0); 
        transform: translate(1px, -1px);
    }
}

@keyframes glitchTitle2 {
    0%, 100% { 
        clip-path: inset(0 0 0 0); 
        transform: translate(0);
    }
    20% { 
        clip-path: inset(60% 0 20% 0); 
        transform: translate(2px, -1px);
    }
    40% { 
        clip-path: inset(20% 0 50% 0); 
        transform: translate(-2px, 1px);
    }
    60% { 
        clip-path: inset(80% 0 10% 0); 
        transform: translate(1px, -2px);
    }
    80% { 
        clip-path: inset(10% 0 80% 0); 
        transform: translate(-1px, 2px);
    }
}

/* Bouton fermer cyberpunk */
.close-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 0, 110, 0.2);
    border: 2px solid var(--neon-pink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(25% 0%, 75% 0%, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0% 75%, 0% 25%);
    transition: all 0.3s ease;
    animation: rotateSlow 10s linear infinite;
}

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

.close-modal-btn:hover {
    background: var(--neon-pink);
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 0 30px var(--neon-pink);
}

.close-icon {
    font-size: 24px;
    animation: pulse 1s infinite;
}

/* Contenu du modal avec scroll cyberpunk */
.cart-modal-content {
    padding: 30px;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
    position: relative;
}

/* Custom scrollbar */
.cart-modal-content::-webkit-scrollbar {
    width: 10px;
}

.cart-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-purple);
}

.cart-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    border-radius: 0;
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* Cart items avec effet holographique */
.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    gap: 20px;
    padding: 20px;
    margin-bottom: 20px;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cart-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 245, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.cart-item:hover::before {
    left: 100%;
}

.cart-item:hover {
    transform: translateX(10px);
    border-color: var(--neon-cyan);
    box-shadow: 
        -10px 0 20px rgba(0, 245, 255, 0.3),
        inset 0 0 20px rgba(0, 245, 255, 0.1);
}

/* Image produit avec effet 3D */
.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 2px solid var(--neon-purple);
    position: relative;
    transition: all 0.3s ease;
}

.cart-item:hover .cart-item-image {
    transform: perspective(300px) rotateY(-15deg) scale(1.1);
    box-shadow: 
        10px 10px 20px rgba(189, 0, 255, 0.5),
        0 0 30px rgba(189, 0, 255, 0.3);
}

/* Info produit */
.cart-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-item-name {
    font-size: 18px;
    color: var(--neon-cyan);
    margin-bottom: 5px;
    text-shadow: 0 0 5px var(--neon-cyan);
}

.cart-item-details {
    font-size: 14px;
    color: #888;
}

/* Prix avec animation néon */
.cart-item-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.price-amount {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    animation: priceGlow 2s ease-in-out infinite;
}

@keyframes priceGlow {
    0%, 100% { 
        text-shadow: 0 0 10px var(--neon-green);
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 20px var(--neon-green), 0 0 40px var(--neon-green);
        transform: scale(1.05);
    }
}

/* Quantité avec contrôles futuristes */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    background: rgba(189, 0, 255, 0.2);
    border: 1px solid var(--neon-purple);
    color: var(--neon-purple);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.quantity-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--neon-purple);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.quantity-btn:hover::before {
    width: 100%;
    height: 100%;
}

.quantity-btn:hover {
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--neon-purple);
}

.quantity-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: white;
    min-width: 30px;
    text-align: center;
}

/* Bouton supprimer avec animation */
.delete-item-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 0, 110, 0.1);
    border: 2px solid rgba(255, 0, 110, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    clip-path: polygon(10% 0%, 90% 0%, 100% 10%, 100% 90%, 90% 100%, 10% 100%, 0% 90%, 0% 10%);
}

.delete-item-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--neon-pink) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
    opacity: 0;
}

.delete-item-btn:hover::before {
    width: 200%;
    height: 200%;
    opacity: 0.5;
}

.delete-item-btn:hover {
    background: rgba(255, 0, 110, 0.3);
    border-color: var(--neon-pink);
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 30px var(--neon-pink);
}

.delete-icon {
    font-size: 24px;
    transition: all 0.3s ease;
    display: inline-block;
    animation: trashShake 4s ease-in-out infinite;
}

@keyframes trashShake {
    0%, 90%, 100% { transform: rotate(0deg); }
    92% { transform: rotate(-5deg); }
    94% { transform: rotate(5deg); }
    96% { transform: rotate(-5deg); }
    98% { transform: rotate(5deg); }
}

.delete-item-btn:hover .delete-icon {
    animation: trashDelete 0.5s ease-in-out;
    color: white;
    filter: drop-shadow(0 0 10px var(--neon-pink));
}

@keyframes trashDelete {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-15deg); }
    50% { transform: scale(0.8) rotate(15deg); }
    75% { transform: scale(1.1) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Animation de suppression du produit */
.cart-item.deleting {
    animation: itemDelete 0.5s ease-out forwards;
}

@keyframes itemDelete {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(50px) scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: translateX(100%) scale(0.5);
        opacity: 0;
        height: 0;
        margin: 0;
        padding: 0;
    }
}

/* Footer du modal avec total */
.cart-modal-footer {
    padding: 30px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.9) 0%, rgba(26, 26, 26, 0.9) 50%, rgba(0, 0, 0, 0.9) 100%);
    border-top: 2px solid var(--neon-cyan);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Total avec effet spectaculaire */
.cart-total {
    display: flex;
    align-items: baseline;
    gap: 20px;
}

.total-label {
    font-size: 24px;
    color: #888;
    text-transform: uppercase;
}

.total-amount {
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(45deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    animation: totalShine 3s linear infinite;
    position: relative;
}

@keyframes totalShine {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.total-amount::after {
    content: attr(data-amount);
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    filter: blur(20px);
    opacity: 0.5;
}

/* Boutons d'action */
.cart-actions {
    display: flex;
    gap: 20px;
}

.cyber-btn {
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cyber-btn.primary {
    background: linear-gradient(45deg, var(--neon-cyan), var(--neon-purple));
    color: white;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
}

.cyber-btn.secondary {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 15px 100%, 0 50%);
}

.cyber-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 245, 255, 0.5);
}

/* Effet de particules flottantes */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-cyan);
    animation: floatParticle 10s linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

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

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: emptyBounce 2s ease-in-out infinite;
}

@keyframes emptyBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.empty-message {
    font-size: 24px;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
}

/* Animations d'entrée/sortie */
@keyframes modalSlideIn {
    0% {
        transform: translate(-50%, -50%) scale(0.8) rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes modalSlideOut {
    0% {
        transform: translate(-50%, -50%) scale(1) rotateX(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8) rotateX(90deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .cart-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .cart-modal-title {
        font-size: 24px;
    }
    
    .cart-item {
        grid-template-columns: 80px 1fr auto;
        grid-template-rows: auto auto;
    }
    
    .cart-item-price {
        grid-column: 1 / 3;
        grid-row: 2;
        margin-top: 10px;
        align-items: flex-start;
    }
    
    .delete-item-btn {
        grid-column: 3;
        grid-row: 1;
        width: 40px;
        height: 40px;
    }
    
    .delete-icon {
        font-size: 20px;
    }
    
    .total-amount {
        font-size: 32px;
    }
    
    .cart-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cyber-btn {
        width: 100%;
    }
}

/* Animation de mise à jour du panier header */
@keyframes cartUpdate {
    0% { 
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 0 rgba(0, 245, 255, 0);
    }
    25% { 
        transform: scale(1.1) rotate(-5deg);
        box-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
    }
    50% { 
        transform: scale(1.2) rotate(5deg);
        box-shadow: 0 0 40px rgba(0, 245, 255, 1);
    }
    75% { 
        transform: scale(1.1) rotate(-3deg);
        box-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
    }
    100% { 
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 0 rgba(0, 245, 255, 0);
    }
}

/* Circuit lines decoration */
.circuit-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.1;
}

.circuit-lines::before,
.circuit-lines::after {
    content: '';
    position: absolute;
    background: var(--neon-cyan);
}

.circuit-lines::before {
    top: 20%;
    left: -100%;
    width: 200%;
    height: 1px;
    animation: circuitMove 8s linear infinite;
}

.circuit-lines::after {
    top: 80%;
    right: -100%;
    width: 200%;
    height: 1px;
    animation: circuitMove 8s linear infinite reverse;
}

@keyframes circuitMove {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(50%); }
}