/* ============================================
   FORMULAIRE CLIENT - STYLES SPÉCIFIQUES
   ============================================ */

/* Limite la largeur du formulaire */
.form-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Grille 2 colonnes pour les champs côte à côte */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Champs en pleine largeur */
.form-group.full-width {
    grid-column: 1 / -1;
}

/* Style des fieldsets (sections avec bordure) */
.client-form fieldset {
    border: 2px solid #e8ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    background: #f8f9fa;
}

.client-form legend {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    padding: 0 10px;
}

/* Centrer les boutons */
.form-actions {
    justify-content: center !important;
    margin-bottom: 50px;
}

/* Icônes dans les legends */
.client-form legend i {
    margin-right: 8px;
    color: var(--accent-color);
}

/* ============================================
   POPUP DE CONFIRMATION
   ============================================ */

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.popup-overlay.show {
    display: flex !important;
}

.popup-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.popup-box h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.popup-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.popup-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s;
}

.popup-btn:hover {
    transform: scale(1.05);
}

.btn-accueil {
    background: #667eea;
    color: white;
}

.btn-sav {
    background: #f5576c;
    color: white;
}

/* ============================================
   SELECT AVEC RECHERCHE INTÉGRÉE
   ============================================ */

/* Conteneur du select custom */
.select-with-search {
    position: relative;
}

/* Input de recherche stylé */
.search-select-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23666" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat right 12px center;
    background-size: 18px;
    cursor: pointer;
}

.search-select-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Dropdown des options */
.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: white;
    border: 2px solid #007bff;
    border-radius: 6px;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
}

.select-dropdown.show {
    display: block;
}

/* Options du dropdown */
.select-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background: #f8f9fa;
}

.select-option.selected {
    background: #e7f3ff;
    color: #007bff;
    font-weight: 600;
}

/* Option "AUTRE" stylée différemment */
.select-option.autre {
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
    border-top: 2px solid #ffc107;
}

.select-option.autre:hover {
    background: #ffe69c;
}

/* Message "Aucun résultat" */
.no-results {
    padding: 15px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ============================================
   AFFICHAGE CLIENT (DOUBLE LIGNE)
   ============================================ */

/* Option client avec affichage double ligne */
.select-option.client-option {
    padding: 10px 15px;
    line-height: 1.4;
}

.select-option.client-option:hover {
    background: #f0f8ff;
    border-left: 3px solid #007bff;
}

/* ============================================
   CHAMP "AUTRE" (SAISIE LIBRE)
   ============================================ */

.autre-input {
    display: none;
    margin-top: 10px;
}

.autre-input.visible {
    display: block;
}

.autre-input input {
    text-transform: uppercase;
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #ffc107;
    border-radius: 6px;
    background: #fffbf0;
    transition: all 0.3s ease;
}

.autre-input input:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.autre-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #856404;
}

/* ============================================
   SCROLLBAR PERSONNALISÉE (DROPDOWN)
   ============================================ */

.select-dropdown::-webkit-scrollbar {
    width: 8px;
}

.select-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

        .checkbox-group {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 10px;
            margin-top: 10px;
        }
        .checkbox-item {
            display: flex;
            align-items: center;
            padding: 8px;
            background: #f5f5f5;
            border-radius: 4px;
        }
        .checkbox-item input[type="checkbox"] {
            margin-right: 8px;
            width: 18px;
            height: 18px;
        }
        .prix-display {
            font-size: 1.2em;
            font-weight: bold;
            color: #4caf50;
            padding: 10px;
            background: #e8f5e9;
            border-radius: 4px;
            text-align: center;
            margin-top: 5px;
        }
        .autre-input {
            display: none;
            margin-top: 10px;
        }
        .autre-input input {
            width: 100%;
        }
        .box-refresh-btn {
            display: inline-block;
            margin-left: 10px;
            padding: 5px 10px;
            background: #2196f3;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.9em;
        }
        .box-refresh-btn:hover {
            background: #1976d2;
        }
        #box_emplacement option[disabled] {
            color: #999;
            font-style: italic;
        }
        #box_emplacement option:not([disabled]) {
            font-weight: 500;
        }

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .form-container {
        padding: 20px 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .client-form fieldset {
        padding: 15px;
    }

    .client-form legend {
        font-size: 16px;
    }

    /* Ajustements pour les selects custom sur mobile */
    .search-select-input {
        font-size: 16px; /* Évite le zoom iOS */
        padding: 10px 35px 10px 12px;
    }

    .select-dropdown {
        max-height: 220px;
    }

    .select-option {
        padding: 10px 12px;
        font-size: 15px;
    }

    /* Affichage client mobile */
    .client-name {
        font-size: 14px;
    }

    .client-info {
        font-size: 12px;
    }

    .autre-input input {
        font-size: 16px;
        padding: 10px 12px;
    }

    /* Popup responsive */
    .popup-box {
        padding: 30px 20px;
        max-width: 90%;
        margin: 0 15px;
    }

    .popup-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .popup-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 15px 10px;
    }

    .client-form fieldset {
        padding: 12px;
        margin-bottom: 20px;
    }

    .select-dropdown {
        max-height: 200px;
    }

    /* Réduire l'espacement des options client sur petit écran */
    .select-option.client-option {
        padding: 8px 10px;
    }

    .client-name {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .client-info {
        font-size: 11px;
    }

    /* Popup mobile */
    .popup-box h2 {
        font-size: 1.3rem;
    }

    .popup-btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}
