/*
 * ========================================================
 * [ÉTAT : FINAL] Date : 22-05-2026 07:15:00
 * FICHIER : a_commander.css
 * RÔLE : Style de la page de commande, barre de recherche et fenêtre modale
 * Auteurs : Yvan Dubé & Gemini (IA Collaboratrice)
 * =========================================================
 */

.container {
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

#sticky-header-commande {
    position: sticky;
    top: 65px; 
    background-color: white;
    z-index: 100;
    padding-top: 25px; 
    margin-top: -20px; 
    padding-bottom: 15px;
    box-shadow: 0 -30px 0 0 white, 0 10px 10px -10px rgba(0,0,0,0.1);
}

.titre-page { color: var(--couleur-primaire); text-align: center; margin-bottom: 15px; }

/* BARRE DE RECHERCHE EN TEMPS RÉEL */
.search-live-container {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.input-search-court {
    flex: 1;
    max-width: 450px;
    padding: 12px 15px;
    font-size: 1.05em;
    border: 2px solid var(--couleur-primaire, #7b1c8d);
    border-radius: 6px;
    box-sizing: border-box;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.05);
}

.btn-lien-commande {
    margin-left: auto;
    background-color: navy; 
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    border: 1px solid navy;
}

.btn-lien-commande:hover {
    background-color: #000050;
    color: white;
}

/* BADGES DE PRIORITÉ */
.badge-prioritaire {
    display: inline-block;
    font-size: 0.8em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.b-syda-style { color: var(--couleur-primaire, #7b1c8d); background-color: #fdf7ff; border: 1px solid var(--couleur-primaire, #7b1c8d); }
.b-reserve-style { color: #2980b9; background-color: #ebf5fb; border: 1px solid #3498db; }
.b-cmd-style { color: #d35400; background-color: #fdf2e9; border: 1px solid #e67e22; }

/* CSS GRID */
.grid-container-commande, .grid-item-commande {
    display: grid;
    grid-template-columns: 80px 100px 1fr 100px 140px 80px;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

.entete-mauve {
    background-color: var(--couleur-primaire);
    color: white;
    font-weight: bold;
    border-radius: 6px;
}

.grid-item-commande { border-bottom: 1px solid var(--couleur-bordure); transition: background-color 0.15s; }
.grid-item-commande:last-child { border-bottom: none; }
.grid-item-commande:hover { background-color: #f9f0ff; cursor: pointer; }
.ligne-selectionnee { background-color: #f3e5f5 !important; border-left: 4px solid var(--couleur-primaire) !important; }

/* ALIGNEMENTS ET UTILITAIRES */
.col-center { text-align: center; }
.align-gauche { text-align: left; }
.font-bold { font-weight: bold; }
.txt-center { text-align: center; }
.mt-30 { margin-top: 30px; }

.img-produit-mini { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--couleur-bordure); }
.qty-input { width: 70px; text-align: center; padding: 6px; border: 2px solid var(--couleur-bordure); border-radius: 4px; font-weight: bold; }
.qty-small { width: 65px; padding: 4px; }

/* BOUTON FLOTTANT */
.btn-flottant {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    background-color: var(--couleur-primaire);
    color: white;
    padding: 15px 35px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(123, 28, 141, 0.4);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}
.btn-flottant:hover:not(:disabled) { transform: scale(1.05); background-color: #621471; }
.btn-flottant:disabled { background-color: #ccc; box-shadow: none; cursor: not-allowed; }

/* FENÊTRE MODALE : RÉSUMÉ DE COMMANDE */
.modal-commande {
    display: none; 
    position: fixed; 
    z-index: 3000; 
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto; 
    padding: 25px;
    border: 2px solid var(--couleur-primaire, #7b1c8d);
    border-radius: 12px;
    width: 80%;
    max-width: 700px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal:hover { color: #000; }

.sub-text-modal { margin-bottom: 15px; font-size: 0.95em; color: #555; }

.table-wrapper-resume {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
}

.table-resume {
    width: 100%;
    border-collapse: collapse;
}
.table-resume th, .table-resume td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.table-resume th { background-color: #f8f0fb; color: var(--couleur-primaire); font-weight: bold; position: sticky; top: 0; }

.btn-remove-resume {
    background: none; border: none; font-size: 1.2em; cursor: pointer; transition: transform 0.15s;
}
.btn-remove-resume:hover { transform: scale(1.2); }

.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}
.btn-annuler-modal { background-color: #e74c3c; color: white; border: none; padding: 10px 18px; border-radius: 6px; font-weight: bold; cursor: pointer; }
.btn-confirmer-modal { background-color: var(--couleur-succes, #27ae60); color: white; border: none; padding: 10px 22px; border-radius: 6px; font-weight: bold; font-size: 1.05em; cursor: pointer; }
.btn-annuler-modal:hover, .btn-confirmer-modal:hover { opacity: 0.9; }

@media (max-width: 768px) {
    .grid-container-commande, .grid-item-commande { grid-template-columns: 1fr; text-align: center; }
    .align-gauche { text-align: center; }
    .modal-content { width: 95%; margin: 10% auto; padding: 15px; }
    .search-live-container { flex-direction: column; }
    .btn-lien-commande { margin-left: 0; width: 100%; }
}