/* ===== STYLES E-COMMERCE 2M DIGITAL SHOP ===== */

/* Variables CSS */
:root {
    --primary-color: #1e40af;
    --secondary-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --border-color: #e5e7eb;
    --text-color: #374151;
    --text-muted: #6b7280;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ===== SECTION PRODUITS POPULAIRES ===== */
.popular-products-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.popular-products-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e2e8f0" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    z-index: 0;
}

.popular-products-section .container {
    position: relative;
    z-index: 1;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ===== CARTES PRODUITS ===== */
.product-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    position: relative;
    overflow: hidden;
    height: 250px;
    background: #f8fafc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-badges .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
    animation: pulse 2s infinite;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
    animation: shimmer 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== SÉLECTEUR DE VARIANTES ===== */
.variant-selector {
    margin-bottom: 1rem;
}

.variant-group {
    margin-bottom: 0.75rem;
}

.variant-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    display: block;
}

.variant-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variant-btn {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 60px;
    text-align: center;
}

.variant-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.variant-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.3);
}

/* ===== AFFICHAGE DES PRIX ===== */
.price-section {
    margin-bottom: 1rem;
    transition: var(--transition);
}

.price-section.price-updated {
    transform: scale(1.02);
    background: rgba(30, 64, 175, 0.05);
    border-radius: 6px;
    padding: 0.5rem;
    margin: -0.5rem;
}

.price-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.regular-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.promo-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.original-price {
    font-size: 1rem;
    color: var(--text-muted);
    text-decoration: line-through;
    position: relative;
}

.original-price::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--danger-color);
    animation: strikethrough 0.5s ease-out;
}

@keyframes strikethrough {
    from { width: 0; }
    to { width: 100%; }
}

.discount-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

.savings-text {
    font-size: 0.8rem;
    color: var(--success-color);
    font-weight: 600;
    background: rgba(22, 163, 74, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

/* ===== ACTIONS PRODUITS ===== */
.product-actions {
    margin-top: auto;
}

.add-to-cart {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
    margin-bottom: 0.5rem;
}

.add-to-cart:hover {
    background: #1e3a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

.add-to-favorites {
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    transition: var(--transition);
}

.add-to-favorites:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: rgba(220, 38, 38, 0.05);
}

.add-to-favorites.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* ===== SECTION PROMOTIONS ===== */
.promotions-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.promo-products-container .product-card {
    border: 2px solid var(--warning-color);
    position: relative;
}

.promo-products-container .product-card::before {
    content: '🔥 PROMO';
    position: absolute;
    top: -1px;
    right: -1px;
    background: var(--warning-color);
    color: white;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0 6px 0 6px;
    z-index: 3;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    padding: 3rem 0;
}

.loading-spinner i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999;
    transform: translateX(400px);
    transition: var(--transition);
    border-left: 4px solid var(--success-color);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left-color: var(--success-color);
}

.notification-success i {
    color: var(--success-color);
}

.notification-error {
    border-left-color: var(--danger-color);
}

.notification-error i {
    color: var(--danger-color);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablettes */
@media (max-width: 992px) {
    .section-title {
        font-size: 2rem;
    }
    
    .product-image {
        height: 220px;
    }
    
    .variant-buttons {
        justify-content: center;
    }
    
    .variant-btn {
        min-width: 50px;
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* Mobiles */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .product-image {
        height: 200px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .variant-selector {
        margin-bottom: 0.75rem;
    }
    
    .variant-group {
        margin-bottom: 0.5rem;
    }
    
    .variant-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .variant-btn {
        min-width: 45px;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .price-container {
        align-items: flex-start;
    }
    
    .promo-price {
        font-size: 1.2rem;
    }
    
    .regular-price {
        font-size: 1.1rem;
    }
    
    .add-to-cart {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Très petits écrans */
@media (max-width: 576px) {
    .popular-products-section,
    .promotions-section {
        padding: 2rem 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-badges {
        top: 5px;
        left: 5px;
    }
    
    .product-badges .badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .variant-buttons {
        gap: 0.25rem;
    }
    
    .variant-btn {
        min-width: 40px;
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
    }
    
    .promo-price {
        font-size: 1.1rem;
    }
    
    .regular-price {
        font-size: 1rem;
    }
    
    .discount-badge {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
    
    .savings-text {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
}

/* ===== ANIMATIONS AVANCÉES ===== */
.product-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Délai d'animation pour effet cascade */
.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }
.product-card:nth-child(7) { animation-delay: 0.7s; }
.product-card:nth-child(8) { animation-delay: 0.8s; }

/* ===== ACCESSIBILITÉ ===== */
.variant-btn:focus,
.add-to-cart:focus,
.add-to-favorites:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8fafc;
        --light-color: #1f2937;
        --text-color: #e5e7eb;
        --text-muted: #9ca3af;
        --border-color: #374151;
    }
    
    .product-card {
        background: #1f2937;
        color: var(--text-color);
    }
    
    .variant-btn {
        background: #374151;
        border-color: #4b5563;
        color: var(--text-color);
    }
    
    .notification {
        background: #1f2937;
        color: var(--text-color);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .product-overlay,
    .product-actions,
    .notification {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

