/* Variables CSS pour la cohérence des couleurs */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --accent-color: #FF5722;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #333333;
    --text-color: #212121;
    --text-light: #757575;
    --white: #ffffff;
    --quantity-bg-one: #444444;
    --quantity-bg-multiple: #eeeeee;
    --quantity-color-one: #ffffff;
    --quantity-color-multiple: #FF0000;
}

/* Styles généraux */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

/* Container principal */
.header-container {
    background-color: var(--white);
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 24px;
}

.file-info {
    display: flex;
    gap: 10px;
}

.info-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

.orders {
    background-color: var(--primary-color);
    color: var(--white);
}

.products {
    background-color: var(--accent-color);
    color: var(--white);
}

/* Boutons */
button {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

.back-button {
    background-color: var(--text-color);
}

.back-button:hover {
    background-color: var(--dark-gray);
}

/* Barre de recherche et filtres */
.search-container {
    background-color: var(--white);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.search-controls {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    max-width: 500px;
}

.search-input {
    padding: 10px 15px;
    border: 1px solid var(--medium-gray);
    border-radius: 30px;
    font-size: 16px;
    width: 100%;
    background-color: var(--light-gray);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.search-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
    margin-left: 15px;
}

.filters {
    display: flex;
    gap: 15px;
}

/* Mise en forme du tableau */
table.xml-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 16px;
    text-align: left;
    background-color: var(--white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

table.xml-table th, table.xml-table td {
    padding: 10px;
    border: 1px solid var(--medium-gray);
}

table.xml-table th {
    position: sticky;
    top: 40px; /* Ajuster en fonction de la hauteur de la barre de progression */
    z-index: 15;
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: bold;
    transition: top 0.3s ease; /* Animation douce */
}

/* Alternance des couleurs de lignes */
table.xml-table tbody tr:nth-child(even) {
    background-color: #f0f0f0 !important; /* Gris légèrement plus foncé pour meilleure visibilité */
}

table.xml-table tbody tr:nth-child(odd) {
    background-color: #ffffff !important;
}

/* Mise en forme spécifique pour les colonnes */
.product-reference,
.product-name {
    font-weight: bold;
}

.product-name {
    max-width: 250px;
}

.product-reference {
    white-space: nowrap;
}

/* Style des cellules de quantité - respect du système de couleurs par valeur */
.quantity {
    font-size: 40px;
    font-weight: bold;
    text-align: center;
    cursor: pointer !important;
    transition: all 0.3s ease;
    position: relative;
}

.quantity-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

/* Style spécifique selon la quantité */
.qty-one {
    background-color: #444444 !important; /* Gris foncé pour quantité = 1 */
    color: #ffffff !important; /* Texte blanc */
}

.qty-multiple {
    background-color: #eeeeee !important; /* Gris clair pour quantité > 1 */
    color: #FF0000 !important; /* Texte rouge */
}

.quantity:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

.quantity:active .quantity-button {
    transform: scale(0.95);
}

/* Style pour les lignes validées - plus visible */
/* Style pour les lignes valides - version amliore */
.validated-row {
    background-color: #c0c0c0 !important; /* Gris plus sombre */
    position: relative;
    transition: all 0.3s ease;
}

.validated-row td {
    color: var(--dark-gray) !important; /* Texte plus fonc */
    transition: color 0.3s ease;
}

.validated-row .product-thumbnail {
    filter: grayscale(100%) brightness(0.7); /* Image plus sombre */
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Indicateur de validation sur la cellule de quantit */
.validated-row .quantity::after {
    content: "OK!";
    position: absolute;
    top: 5px;
    right: 5px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
}

/* Style pour l'en-tte de ligne valide */
table.xml-table .validated-row th {
    background-color: #464545 !important; 
    color: #ffffff !important; 
    opacity: 0.9 !important;
}

/* Modal de confirmation */
.modal {
    display: none !important; /* Forcer la dissimulation */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0; /* Commencer à 0 pour l'animation */
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    background-color: #ffffff !important;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-modal {
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    background-color: #ffffff; /* Fond blanc pour le corps de la modal */
}

.modal-product-info {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    line-height: 1.6;
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--medium-gray);
    background-color: #ffffff; /* Fond blanc pour le pied de la modal */
}

.confirm-button {
    background-color: #4CAF50 !important; /* Vert pour le bouton de validation */
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.cancel-button {
    background-color: #F44336 !important; /* Rouge pour le bouton d'annulation */
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Fenêtre modal pour les images */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#imageModal {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

#modalImage {
    max-width: 100%;
    max-height: 90vh;
    border: 5px solid var(--white);
    border-radius: 5px;
}

#closeModalButton {
    position: absolute;
    top: -30px;
    right: -30px;
    color: var(--white);
    font-size: 30px;
    cursor: pointer;
}

/* Conteneur d'image dans le tableau */
.image-container {
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: var(--light-gray);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.product-thumbnail {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 5px;
}

.image-container:hover .product-thumbnail {
    transform: scale(1.1);
}

.image-container:hover::after {
    content: "🔍";
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.no-image {
    color: var(--text-light);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    background-color: var(--light-gray);
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

/* Indicateur de stock */
.stock-info {
    font-size: 12px;
    padding: 3px 5px;
    border-radius: 3px;
    background-color: var(--medium-gray);
    color: var(--text-color);
    white-space: nowrap;
}

.low-stock {
    background-color: var(--warning-color);
    color: var(--dark-gray);
    font-weight: bold;
}

/* Barre de progression */
.progress-container {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    background-color: white;
    padding: 10px 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


.progress-bar {
    width: 85%;
    height: 25px;
	text-align: center;
    background-color: var(--medium-gray);
    border-radius: 25px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #FF9800;
    color: var(--white);
    text-align: center;
    line-height: 25px;
    font-weight: bold;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-weight: bold;
    color: var(--text-color);
}

/* Message d'erreur */
.error-message, .error-container {
    background-color: #FFEBEE;
    border-left: 5px solid var(--danger-color);
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    color: var(--text-color);
}

.error-container h2 {
    color: var(--danger-color);
    margin-top: 0;
}

.error-container ul {
    margin: 0;
    padding-left: 20px;
}

/* Table container avec défilement horizontal */
.table-container {
    margin-top: 10px; /* Espace entre la barre de progression et le tableau */
}

/* Responsive design */
@media screen and (max-width: 1024px) {
    .search-container {
        flex-direction: column;
    }
    
    .search-controls {
        width: 100%;
        max-width: none;
        margin-bottom: 15px;
    }
    
    .filters {
        width: 100%;
        justify-content: space-between;
    }
    
    table.xml-table {
        min-width: 900px;
    }
    
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    h1 {
        margin-bottom: 15px;
        font-size: 20px;
    }
    
    .file-info {
        margin-top: 10px;
    }
	
}