/* Styles de base et typographie */
/* Styles de base et typographie */
body {
    font-family: Arial, sans-serif;
    background-color: #f8f8f8;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 300;
}

#delivery-date-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1; /* Prend 1/3 de la place */
}

#delivery-date-controls label {
    font-weight: bold;
    font-size: 0.9em;
}

#delivery-date-display {
    font-size: 0.9em;
    color: #007bff;
    font-weight: bold;
}

#increment-date-btn {
    font-size: 1.2em;
    font-weight: bold;
    padding: 2px 8px;
    line-height: 1;
    background-color: #28a745;
    color: white;
}

#decrement-date-btn {
    font-size: 1.2em;
    font-weight: bold;
    padding: 2px 9px; /* Léger ajustement pour centrer le '-' */
    line-height: 1;
    background-color: #dc3545;
    color: white;
}

#cart-status {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Aligne le contenu à droite */
    font-size: 1.2em;
    font-weight: bold;
    flex: 1; /* Prend 1/3 de la place */
}

#cart-status svg {
    margin-right: 10px;
}

#cart-item-count {
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8em;
    min-width: 20px;
    text-align: center;
}

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.content-panel {
    flex: 2;
    /* Allow scrolling on the left panel */
    max-height: calc(100vh - 100px); /* Adjust based on header height */
    overflow-y: auto;
}

.cart-panel {
    flex: 1;
    position: sticky;
    top: 80px; /* Match header height */
    height: fit-content;
}

h1 {
    text-align: center;
    color: #007bff; /* Bleu */
    padding-top: 0;
    margin: 0;
    font-size: 1.8em;
}

h2 {
    color: #28a745; /* Vert */
    border-bottom: 2px solid #28a745;
    padding-bottom: 5px;
    margin-top: 30px;
}

hr {
    border: 0;
    height: 1px;
    background: #ddd;
    margin: 20px 0;
}

/* --- Contrôles et Filtres --- */
.client-controls, #article-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap; 
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    width: 100%;
}

#toggle-filters-btn {
    padding: 8px 12px;
    background-color: #6c757d;
    color: white;
    flex-shrink: 0;
}

.dropdown-filter {
    position: relative;
}

#colors-filter-btn {
    padding: 8px 12px;
    background-color: #6f42c1; /* Purple */
    color: white;
}

#keragold-filter-btn {
    padding: 8px 12px;
    background-color: #ffc107; /* Yellow */
    color: #333;
}

#keragold-filter-btn:hover {
    background-color: #e0a800;
}

#colors-dropdown {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

#colors-dropdown button {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}

#colors-dropdown button:hover {
    background-color: #ddd;
}

.dropdown-filter .visible {
    display: block;
}

#colors-dropdown.visible {
    display: block;
}

.collapsible {
    display: none;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.collapsible.visible {
    display: flex;
}

.filter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

input[type="text"], input[type="number"], select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    width: 250px; 
}

/* Specific width for article quantity input */
input.article-qty-input {
    width: 60px;
}

/* --- Section Client --- */
.client-search {
    position: relative;
}

.suggestions-dropdown {
    position: absolute;
    z-index: 200;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #e9ecef;
}

.selected-info {
    font-size: 1.1em;
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f8ff;
    border: 1px solid #cce5ff;
}

/* --- Filtre des Articles (Le Rendu Sticky) --- */
#article-controls {
    /* PROPRIÉTÉS CLÉS POUR LA PERSISTANCE */
    position: sticky; 
    top: 0; 
    z-index: 100; 

    /* Styles de présentation */
    background-color: #fff; 
    padding: 15px 0; 
    margin-bottom: 20px; 
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 2px -2px rgba(0, 0, 0, 0.2); 
}

/* --- Tableaux de Données (Articles et Panier) --- */
.data-table-container {
    width: 100%;
    overflow-x: auto; 
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #007bff; /* Bleu */
    color: white;
    position: sticky; 
    z-index: 50; 
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

/* Styles pour les lignes en rupture de stock/en attente dans la liste d'articles */
tr.low-stock {
    background-color: #fdd; /* Fond rouge très clair */
    opacity: 0.9;
}

/* NOUVEAU: Styles pour les articles en attente DANS LE PANIER */
tr.cart-backorder {
    background-color: #fff3cd; /* Jaune clair pour l'alerte */
}
tr.cart-backorder:nth-child(even) {
    background-color: #ffeda9; /* Un peu plus foncé pour le striping */
}

.backorder-label {
    font-size: 0.85em;
    font-style: italic;
    color: #856404; /* Couleur texte foncée pour le jaune */
}

/* --- Contrôles de Quantité (Panier) --- */
.cart-qty-control {
    display: flex;
    align-items: center;
}

.qty-control-btn {
    background-color: #007bff; /* Bleu */
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    margin: 0 5px;
    font-weight: bold;
}

.qty-control-btn:hover {
    background-color: #0056b3;
}

.cart-qty-value {
    padding: 0 10px;
}

/* --- Boutons --- */
button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.add-to-cart-btn {
    background-color: #28a745; /* Vert (couleur par défaut pour stock > 0) */
    color: white;
}

.add-to-cart-btn:hover {
    background-color: #1e7e34;
}

/* NOUVEAU STYLE: Bouton Mettre en attente (quand stock <= 0) */
tr.low-stock .add-to-cart-btn {
    background-color: #ff8c00; /* Orange foncé pour "Mettre en attente" */
}

tr.low-stock .add-to-cart-btn:hover {
    background-color: #e67e00; 
}

.remove-from-cart-btn {
    background-color: #dc3545; /* Rouge */
    color: white;
}

.remove-from-cart-btn:hover {
    background-color: #bd2130;
}

#checkout-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    background-color: #ffc107; /* Jaune/Orange */
    color: #333;
    font-size: 1.2em;
}

#checkout-btn:hover:not(:disabled) {
    background-color: #e0a800;
}

#checkout-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- Section Total Panier --- */
#cart-total-info {
    margin-top: 20px;
    padding: 15px;
    border: 2px solid #28a745; /* Vert */
    border-radius: 5px;
    background-color: #e9f7ef;
    text-align: right;
}

#cart-total-info h3 {
    color: #dc3545; /* Rouge pour le total TTC */
    margin: 5px 0 0;
}

/* --- Styles pour la modale et le FAB (Mobile) --- */
#cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

#cart-overlay.hidden {
    display: none;
}

#cart-modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

#close-cart-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    line-height: 1;
    background: none;
    border: none;
    color: #888;
    padding: 0;
}

.fab-left {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Changed from right */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 900;
    border: none;
}

.fab-left.hidden {
    display: none;
}

#fab-cart-item-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 3px 7px;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 22px;
    text-align: center;
}

/* --- Animation pour le panier --- */
@keyframes cart-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.cart-pulse-animation {
  animation: cart-pulse 0.4s ease-in-out;
}


/* --- Media Query pour le Responsive --- */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        padding: 10px;
    }

    .content-panel {
        max-height: none;
        overflow-y: visible;
        width: 100%;
    }

    /* On cache les éléments du desktop */
    .cart-panel {
        display: none;
    }
    #cart-status {
        display: none;
    }

    /* On affiche les éléments du mobile */
    .fab-left {
        display: flex;
    }
    
    /* On rend les filtres sticky sur mobile aussi */
    #article-controls {
        top: 60px; /* Hauteur approximative du header */
    }

    /* Transformation des tableaux en cartes */
    .data-table-container table, 
    .data-table-container thead, 
    .data-table-container tbody, 
    .data-table-container th, 
    .data-table-container td, 
    .data-table-container tr {
        display: block;
    }

    .data-table-container thead {
        display: none; /* On cache les en-têtes du tableau */
    }

    .data-table-container tr {
        border: 1px solid #ddd;
        border-radius: 5px;
        margin-bottom: 15px;
    }

    .data-table-container td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Laisse de la place pour le label */
        text-align: right;
    }
    .data-table-container td:last-child {
        border-bottom: none;
    }

    .data-table-container td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #333;
    }

    /* Ajustements spécifiques pour les inputs et boutons dans les cellules */
    .data-table-container td[data-label="Qté"],
    .data-table-container td[data-label="Action"],
    .data-table-container td[data-label="Quantité"] {
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .cart-qty-control {
        justify-content: flex-end;
    }
}
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 10px 15px rgba(0, 123, 255, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
  }
}

.pulse-feedback {
  animation: pulse 0.5s;
}.nuance-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Increased gap */
    margin-bottom: 20px;
}

.nuance-btn {
    margin: 5px;
    padding: 10px 15px; /* Ensure decent padding */
}

.nuance-btn.disabled { background-color: #e9ecef; color: #6c757d; cursor: not-allowed; opacity: 0.7; }

.nuance-btn.selected-nuance {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    font-weight: bold;
}
.nuance-btn.selected-nuance::after {
    content: " ✓";
}


/* Styling for default quantity control */
.default-qty-control {
    display: flex;
    align-items: center;
    gap: 0; /* No gap between buttons and input */
}

.default-qty-control button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    height: 34px; /* Match input height */
    box-sizing: border-box; /* Include padding and border in the element"s total width and height */
}

.default-qty-control button:hover {
    background-color: #e0e0e0;
}

.default-qty-control button#decrement-default-qty-btn {
    border-radius: 4px 0 0 4px; /* Rounded left corner */
}

.default-qty-control button#increment-default-qty-btn {
    border-radius: 0 4px 4px 0; /* Rounded right corner */
}

.default-qty-control input[type="number"] {
    text-align: center;
    -moz-appearance: textfield; /* Hide Firefox default number input arrows */
    width: 50px; /* Adjust width as needed */
    height: 34px; /* Match button height */
    border: 1px solid #ccc;
    border-left: none; /* No border between button and input */
    border-right: none;
    padding: 0; /* Remove default padding */
    font-size: 1em;
    box-sizing: border-box;
}

/* Hide Chrome/Safari default number input arrows */
.default-qty-control input[type="number"]::-webkit-outer-spin-button,
.default-qty-control input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


.fab-left {
    cursor: grab;
}

body {
    user-select: none; /* Prevent text selection during drag */
}


/* Styling for client info button */
#client-info-btn {
    margin-left: 10px;
    padding: 5px 10px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    cursor: pointer;
    border: none;
    line-height: 1; /* Center the "i" */
    width: 30px;
    height: 30px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    vertical-align: middle;
}

#client-info-btn:hover {
    background-color: #0056b3;
}

/* Modal Overlay Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto; /* Allow scrolling if content is too tall */
}

.modal-overlay.hidden {
    display: none;
}

/* Modal Content Styles */
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 90vh; /* Max height for content */
    overflow-y: auto; /* Enable scrolling within content */
}

.modal-content h2 {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.modal-content p strong {
    min-width: 120px; /* Align labels */
    display: inline-block;
}

/* Close button for modal */
.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    line-height: 1;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 0;
}

.close-modal-btn:hover {
    color: #333;
}

/* Specific styling for client details body */
#client-details-body p span {
    font-weight: normal;
    color: #555;
}


/* Styles for address actions (copy/map buttons) */
.address-actions {
    display: inline-flex;
    gap: 5px;
    margin-left: 10px;
    vertical-align: middle;
}

.address-actions button {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1;
}

.address-actions button:hover {
    background-color: #e0e0e0;
}

/* Style for the "Retour aux Marques" button */
#back-to-brands-btn {
    background-color: #dc3545; /* Red color to stand out */
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

#back-to-brands-btn:hover {
    background-color: #c82333;
}

#back-to-articles-btn {
    background-color: #dc3545; /* Red */
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

#back-to-articles-btn:hover {
    background-color: #c82333;
}



/* Styles for Quick Link Buttons (HMJ, MHN) */
.quick-links {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.quick-link-btn {
    padding: 10px 20px;
    background-color: #17a2b8; /* Teal color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    transition: background-color 0.3s;
}

.quick-link-btn:hover {
    background-color: #138496;
}