/* ============================================
   CSS pour le module Gestion Tournées
   EDEN OSTREA - 2024
   ============================================ */

/* ====================================
   Vue Attribution - Cases à cocher
   ==================================== */
.gestiontournees-attribution-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.gestiontournees-attribution-table th {
    background-color: #f5f5f5;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.gestiontournees-attribution-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.gestiontournees-attribution-table tr:hover {
    background-color: #f9f9f9;
}

.gestiontournees-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.gestiontournees-actions {
    margin: 20px 0;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.gestiontournees-actions select {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 200px;
}

.gestiontournees-actions button {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
}

.btn-secondary {
    background-color: #888;
    color: white;
}

.btn-secondary:hover {
    background-color: #666;
}

/* ====================================
   Vue Organisation - Drag & Drop
   ==================================== */
.gestiontournees-organisation-container {
    margin-top: 20px;
}

.gestiontournees-poids-total {
    padding: 15px;
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
}

.gestiontournees-tournee-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gestiontournees-tournee-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: move;
    transition: all 0.2s ease;
}

.gestiontournees-tournee-item:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gestiontournees-drag-handle {
    font-size: 20px;
    color: #888;
    margin-right: 15px;
    cursor: grab;
}

.gestiontournees-drag-handle:active {
    cursor: grabbing;
}

.gestiontournees-ordre-numero {
    font-size: 18px;
    font-weight: bold;
    color: #2196F3;
    min-width: 40px;
    text-align: center;
    margin-right: 15px;
}

.gestiontournees-commande-info {
    flex: 1;
    display: flex;
    gap: 20px;
    align-items: center;
}

.gestiontournees-commande-ref {
    font-weight: bold;
    min-width: 120px;
}

.gestiontournees-commande-client {
    flex: 1;
}

.gestiontournees-commande-poids {
    font-weight: bold;
    color: #4CAF50;
    min-width: 80px;
    text-align: right;
}

/* État pendant le drag */
.gestiontournees-tournee-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    cursor: grabbing;
}

.gestiontournees-tournee-item.drag-over {
    border-color: #4CAF50;
    border-style: dashed;
    background-color: #f1f8f4;
}

/* ====================================
   Vue Préparation
   ==================================== */
.gestiontournees-preparation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.gestiontournees-preparation-table th {
    background-color: #f5f5f5;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.gestiontournees-preparation-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.gestiontournees-preparation-table tr:hover {
    background-color: #f9f9f9;
}

.gestiontournees-position-prep {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
}

.gestiontournees-position-livr {
    font-size: 14px;
    color: #888;
}

.gestiontournees-commande-preparee {
    background-color: #e8f5e9 !important;
}

.gestiontournees-badge-prepare {
    display: inline-block;
    padding: 4px 10px;
    background-color: #4CAF50;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* ====================================
   Filtres communs
   ==================================== */
.gestiontournees-filtres {
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.gestiontournees-filtres label {
    font-weight: bold;
    margin-right: 5px;
}

.gestiontournees-filtres select,
.gestiontournees-filtres input[type="date"] {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ====================================
   Messages et alertes
   ==================================== */
.gestiontournees-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.gestiontournees-message.success {
    background-color: #e8f5e9;
    border-color: #4CAF50;
    color: #2e7d32;
}

.gestiontournees-message.error {
    background-color: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.gestiontournees-message.info {
    background-color: #e3f2fd;
    border-color: #2196F3;
    color: #1565c0;
}

/* ====================================
   Responsive
   ==================================== */
@media (max-width: 768px) {
    .gestiontournees-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gestiontournees-actions select,
    .gestiontournees-actions button {
        width: 100%;
    }
    
    .gestiontournees-commande-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .gestiontournees-filtres {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ====================================
   Utilitaires
   ==================================== */
.gestiontournees-hidden {
    display: none;
}

.gestiontournees-text-center {
    text-align: center;
}

.gestiontournees-text-muted {
    color: #888;
    font-style: italic;
}

.gestiontournees-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================================
   Vue Préparation - Lignes dépliables
   ==================================== */

/* Bouton pour déplier/replier le détail */
.gestiontournees-btn-toggle-detail {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.gestiontournees-btn-toggle-detail:hover {
    background-color: #1976D2;
}

.gestiontournees-btn-toggle-detail.expanded {
    background-color: #FF9800;
}

.gestiontournees-btn-toggle-detail.expanded:hover {
    background-color: #F57C00;
}

.gestiontournees-btn-toggle-detail .toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

/* Ligne de détail */
.gestiontournees-detail-row {
    background-color: #f0f8ff;
    border-left: 4px solid #2196F3;
}

.gestiontournees-detail-row td {
    padding: 15px 20px !important;
}

.gestiontournees-detail-content {
    padding: 10px;
}

.gestiontournees-detail-content strong {
    font-size: 15px;
    color: #2196F3;
    display: block;
    margin-bottom: 10px;
}

/* Liste des produits */
.gestiontournees-produits-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.gestiontournees-produits-list li {
    padding: 8px 12px;
    margin: 5px 0;
    background-color: white;
    border-left: 3px solid #4CAF50;
    border-radius: 4px;
    font-size: 14px;
}

.gestiontournees-produits-list li strong {
    color: #4CAF50;
    font-size: 14px;
    margin-right: 5px;
    display: inline;
}

.gestiontournees-produits-list .produit-nom {
    color: #333;
    font-weight: 500;
}

/* Animation d'apparition */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gestiontournees-detail-row[style*="table-row"] {
    animation: fadeIn 0.3s ease-out;
}