/**
 * CSS de la boutique AOTL Cyclisme - Version simplifiée sans filtres
 */

/* Variables CSS */
:root {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --secondary-color: #3b82f6;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset et base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.boutique-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
}

/* Hero de la page */
.page-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.page-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Messages d'alerte */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    animation: slideInAlert 0.3s ease;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* Section des produits */
.products-section {
    margin-bottom: 4rem;
}

.products-header {
    margin-bottom: 2rem;
    text-align: center;
}

.products-count {
    font-size: 1.125rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* Grille des produits */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Carte produit */
.product-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Image du produit */
.product-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.product-image-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.product-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-main-image {
    transform: scale(1.05);
}

/* Badges de stock */
.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stock-badge.out-of-stock {
    background-color: var(--danger-color);
    color: white;
}

.stock-badge.low-stock {
    background-color: var(--warning-color);
    color: white;
}

/* Overlay des actions */
.product-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.btn-quick-view {
    background: white;
    color: var(--gray-900);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-quick-view:hover {
    background: var(--gray-100);
    transform: scale(1.05);
}

/* Informations produit */
.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.product-category {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-description {
    color: var(--gray-700);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Tailles disponibles */
.product-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.size-option {
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-option.available {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.size-option.available:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.size-option.unavailable {
    background: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Actions produit */
.product-actions {
    margin-top: 1rem;
}

.btn-add-to-cart {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-add-to-cart:hover:not(.disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-add-to-cart.disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
}

/* Message aucun produit */
.no-products {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.no-products i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.no-products h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

/* Informations de retrait */
.info-retrait {
    background: var(--gray-100);
    padding: 3rem 0;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
}

.info-icon {
    font-size: 3rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.info-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gray-900);
}

.info-content p {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.info-content address {
    font-style: normal;
    color: var(--gray-700);
    margin: 0.5rem 0;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.modal-overlay.active {
    display: block;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    flex: 1;
    padding-right: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

/* Layout modal produit */
.modal-product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.modal-product-image {
    position: relative;
}

.modal-main-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    background: var(--gray-100);
}

.modal-image-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.modal-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-thumb:hover,
.modal-thumb.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Détails produit modal */
.modal-product-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-product-info .product-category {
    margin-bottom: 0.5rem;
}

.modal-product-info .product-description {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.modal-product-info .product-price {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

/* Formulaire modal */
.size-selection,
.quantity-selection {
    margin-bottom: 1.5rem;
}

.size-selection label,
.quantity-selection label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.size-selection select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
}

.stock-info {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls button {
    background: var(--gray-200);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quantity-controls button:hover {
    background: var(--gray-300);
}

.quantity-controls input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 1rem;
}

/* Actions modal */
.modal-actions {
    border-top: 1px solid var(--gray-200);
    padding-top: 1.5rem;
    margin-top: auto;
}

.btn-add-modal {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    min-height: 50px;
}

.btn-add-modal:hover {
    background: var(--primary-hover);
}

.login-required {
    text-align: center;
    color: var(--gray-600);
    font-style: italic;
    padding: 1rem;
}

.login-required a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-required a:hover {
    text-decoration: underline;
}

/* Galerie modal */
.gallery-modal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
}

.gallery-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.gallery-main {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 1rem;
    pointer-events: none;
}

.gallery-nav-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.gallery-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.gallery-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-thumb:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.gallery-thumb.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Notifications */
.modal-notification {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    animation: slideInModal 0.3s ease;
}

.notification-success {
    background: #d1fae5;
    color: #065f46;
}

.notification-error {
    background: #fee2e2;
    color: #991b1b;
}

.notification-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Animations */
@keyframes slideInAlert {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInModal {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    /* Modal responsive pour tablette */
    .modal-content {
        width: 95%;
        max-height: 95vh;
        top: 2.5vh;
        transform: translateX(-50%);
        position: fixed;
    }
    
    .modal-product-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .modal-main-image {
        max-height: 300px;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-product-info .product-price {
        font-size: 1.75rem;
    }
    
    .gallery-container {
        height: 60vh;
    }
    
    .gallery-nav {
        padding: 0 0.5rem;
    }
    
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .gallery-thumb {
        width: 60px;
        height: 60px;
    }
    
    .modal-thumb {
        width: 50px;
        height: 50px;
    }
    
    .info-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .info-icon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .page-hero {
        padding: 2rem 0;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Modal mobile optimisée */
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
        position: fixed;
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 2px solid var(--gray-200);
        flex-shrink: 0;
    }
    
    .modal-header h2 {
        font-size: 1.125rem;
        line-height: 1.3;
    }
    
    .modal-close {
        font-size: 1.25rem;
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 1rem;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-product-layout {
        gap: 1rem;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .modal-product-image {
        flex-shrink: 0;
    }
    
    .modal-main-image {
        max-height: 250px;
        width: 100%;
        object-fit: contain;
    }
    
    .modal-image-thumbs {
        gap: 0.375rem;
        margin-top: 0.75rem;
        padding: 0.375rem 0;
    }
    
    .modal-thumb {
        width: 45px;
        height: 45px;
    }
    
    .modal-product-details {
        gap: 1rem;
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .modal-product-info {
        flex-shrink: 0;
    }
    
    .modal-product-info .product-category {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .modal-product-info .product-description {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
        line-height: 1.5;
    }
    
    .modal-product-info .product-price {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Formulaire mobile optimisé */
    .size-selection,
    .quantity-selection {
        margin-bottom: 1rem;
    }
    
    .size-selection label,
    .quantity-selection label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .size-selection select {
        padding: 0.875rem;
        font-size: 1rem;
        border-width: 2px;
    }
    
    .stock-info {
        font-size: 0.8125rem;
        margin-top: 0.375rem;
    }
    
    .quantity-controls {
        justify-content: center;
    }
    
    .quantity-controls button {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }
    
    .quantity-controls input {
        width: 70px;
        padding: 0.75rem 0.5rem;
        font-size: 1rem;
        border-width: 2px;
    }
    
    /* Actions sticky en bas sur mobile */
    .modal-actions {
        margin-top: auto;
        padding: 1rem 0 0 0;
        background: white;
        border-top: 2px solid var(--gray-200);
        position: sticky;
        bottom: 0;
    }
    
    .btn-add-modal {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 55px;
        border-radius: 12px;
        font-weight: 700;
    }
    
    .login-required {
        padding: 1rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Galerie mobile */
    .gallery-container {
        height: 50vh;
    }
    
    .gallery-modal .modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .gallery-thumbs {
        padding: 0.5rem;
        gap: 0.25rem;
    }
    
    .gallery-thumb {
        width: 50px;
        height: 50px;
    }
    
    .gallery-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }
}

/* Styles spécifiques pour très petits écrans */
@media (max-width: 360px) {
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    .modal-main-image {
        max-height: 200px;
    }
    
    .modal-product-info .product-price {
        font-size: 1.375rem;
    }
    
    .modal-thumb {
        width: 40px;
        height: 40px;
    }
    
    .quantity-controls button {
        width: 40px;
        height: 40px;
    }
    
    .quantity-controls input {
        width: 60px;
    }
    
    .btn-add-modal {
        min-height: 50px;
        font-size: 0.9375rem;
    }
}

/* Amélioration du scroll sur mobile */
@media (max-width: 480px) {
    .modal-body {
        scroll-behavior: smooth;
    }
    
    /* Masquer la scrollbar mais garder la fonctionnalité */
    .modal-body::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }
    
    /* Améliorer le touch scroll */
    .modal-image-thumbs,
    .gallery-thumbs {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .modal-image-thumbs::-webkit-scrollbar,
    .gallery-thumbs::-webkit-scrollbar {
        display: none;
    }
}

/* États spéciaux */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* Focus states pour l'accessibilité */
button:focus,
select:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Styles pour les éléments interactifs */
.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable:hover {
    transform: translateY(-1px);
}

/* Utilitaires */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.visible { display: block !important; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

/* Dark mode support (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-100: #374151;
        --gray-200: #4b5563;
        --gray-300: #6b7280;
        --gray-500: #9ca3af;
        --gray-700: #d1d5db;
        --gray-900: #f9fafb;
    }
    
    .boutique-page {
        background-color: #1f2937;
        color: var(--gray-900);
    }
    
    .product-card,
    .modal-content,
    .info-card {
        background-color: #374151;
        border-color: #4b5563;
    }
}

/* ==============================================
   CORRECTION - TAILLE IMAGE MODAL PRODUIT
   ============================================== */

/* Image principale de la modal - Taille optimisée */
.modal-main-image {
    width: 100%;
    max-height: 350px; /* Réduction de 400px à 350px */
    height: auto; /* Maintenir les proportions */
    object-fit: contain; /* Contenir l'image entière */
    border-radius: var(--border-radius);
    background: var(--gray-100);
    display: block;
    margin: 0 auto; /* Centrer l'image */
}

/* Conteneur de l'image dans la modal */
.modal-product-image {
    position: relative;
    max-height: 400px; /* Limiter la hauteur du conteneur */
    overflow: hidden;
    border-radius: var(--border-radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Layout modal produit - Ajustement des proportions */
.modal-product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    min-height: 400px; /* Hauteur minimale pour cohérence */
}

/* Responsive - Tablette */
@media (max-width: 768px) {
    .modal-main-image {
        max-height: 280px; /* Réduction pour tablette */
    }
    
    .modal-product-image {
        max-height: 320px;
    }
    
    .modal-product-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .modal-main-image {
        max-height: 220px; /* Taille optimisée mobile */
    }
    
    .modal-product-image {
        max-height: 250px;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
        position: fixed;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .modal-main-image {
        max-height: 180px;
    }
    
    .modal-product-image {
        max-height: 200px;
    }
}

/* ==============================================
   AMÉLIORATIONS COMPLÉMENTAIRES
   ============================================== */

/* Optimisation de l'affichage des miniatures */
.modal-image-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.modal-image-thumbs::-webkit-scrollbar {
    height: 4px;
}

.modal-image-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.modal-image-thumbs::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.modal-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-thumb:hover,
.modal-thumb.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Amélioration de l'indicateur d'image principale */
.thumb-main-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--primary-color);
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Animation de changement d'image */
.modal-main-image {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal-main-image.changing {
    opacity: 0.7;
    transform: scale(0.98);
}

/* État de chargement pour les images */
.modal-main-image[src=""] {
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-main-image[src=""]:before {
    content: "⏳";
    font-size: 2rem;
    color: var(--gray-500);
}

/* ==============================================
   MODAL PRODUIT - MINIATURES EN DESSOUS
   ============================================== */

/* Conteneur principal de l'image dans la modal */
.modal-product-image {
    position: relative;
    display: flex;
    flex-direction: column; /* Colonne pour mettre les miniatures en dessous */
    gap: 1rem;
}

/* Image principale de la modal */
.modal-main-image {
    width: 100%;
    max-height: 350px;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    background: var(--gray-100);
    display: block;
    margin: 0 auto;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Conteneur des miniatures - maintenant en dessous */
.modal-image-thumbs {
    display: flex;
    gap: 0.75rem;
    justify-content: center; /* Centrer les miniatures */
    flex-wrap: wrap; /* Permettre le retour à la ligne si nécessaire */
    padding: 0.5rem 0;
    margin-top: 0; /* Supprimer la marge du haut */
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

/* Style des miniatures */
.modal-thumb {
    flex-shrink: 0;
    width: 70px; /* Légèrement plus grandes */
    height: 70px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--gray-100);
}

.modal-thumb:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.modal-thumb.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    transform: scale(1.02);
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.modal-thumb:hover img {
    transform: scale(1.1);
}

/* Badge d'image principale */
.thumb-main-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid white;
}

/* Layout modal produit ajusté */
.modal-product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    min-height: 400px;
}

/* Animation de changement d'image */
.modal-main-image.changing {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Barres de scroll des miniatures */
.modal-image-thumbs::-webkit-scrollbar {
    height: 6px;
}

.modal-image-thumbs::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.modal-image-thumbs::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.modal-image-thumbs::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Indicateur de scroll si plusieurs miniatures */
.modal-image-thumbs.scrollable::after {
    content: "↔";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0.7;
}

/* ==============================================
   RESPONSIVE DESIGN
   ============================================== */

/* Tablette */
@media (max-width: 768px) {
    .modal-main-image {
        max-height: 280px;
    }
    
    .modal-product-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .modal-thumb {
        width: 60px;
        height: 60px;
    }
    
    .modal-image-thumbs {
        gap: 0.5rem;
        justify-content: flex-start; /* Alignement à gauche sur tablette */
        overflow-x: auto;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .modal-main-image {
        max-height: 220px;
    }
    
    .modal-thumb {
        width: 55px;
        height: 55px;
    }
    
    .modal-image-thumbs {
        gap: 0.4rem;
        padding: 0.5rem;
        justify-content: flex-start;
        background: var(--gray-50);
        border-radius: var(--border-radius);
        margin: 0.5rem 0;
    }
    
    .thumb-main-badge {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
        top: -1px;
        right: -1px;
    }
    
    /* Modal full-screen sur mobile */
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
        position: fixed;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .modal-product-layout {
        gap: 1rem;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .modal-product-image {
        flex-shrink: 0;
        gap: 0.75rem;
    }
    
    .modal-product-details {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .modal-main-image {
        max-height: 180px;
    }
    
    .modal-thumb {
        width: 45px;
        height: 45px;
    }
    
    .modal-image-thumbs {
        gap: 0.3rem;
    }
    
    .thumb-main-badge {
        width: 14px;
        height: 14px;
        font-size: 0.5rem;
    }
}

/* ==============================================
   AMÉLIORATIONS VISUELLES
   ============================================== */

/* État de chargement */
.modal-main-image[src=""] {
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.modal-main-image[src=""]:before {
    content: "⏳";
    font-size: 2rem;
    color: var(--gray-500);
    animation: pulse 1.5s infinite;
}

/* État d'erreur */
.modal-main-image.error {
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.modal-main-image.error:before {
    content: "📷";
    font-size: 2rem;
    color: var(--gray-400);
}

/* Hover effect sur l'image principale */
.modal-main-image:hover {
    transform: scale(1.02);
    cursor: zoom-in;
}

/* Style pour les miniatures en cours de chargement */
.modal-thumb.loading {
    opacity: 0.6;
}

.modal-thumb.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Focus pour l'accessibilité */
.modal-thumb:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Support du mode sombre */
@media (prefers-color-scheme: dark) {
    .modal-main-image,
    .modal-thumb {
        background: #374151;
    }
    
    .modal-image-thumbs {
        background: #1f2937;
    }
    
    .thumb-main-badge {
        border-color: #374151;
    }
}

