/**
 * DWS Search Form Stylesheet
 * Version: 4.2.3
 */

/* Variables de couleur et de police (générées via les options du plugin si nécessaire) */
:root {
    --dws-primary-color: #C48F56;
    --dws-secondary-color: #4A5568;
    --dws-text-on-accent: #FFFFFF;
    --dws-button-bg: #2D3748;
    --dws-button-hover-bg: #1A202C;
    --dws-checkbox-checked-bg: #C48F56;
    --dws-checkbox-checked-border: #A07646;
    --dws-checkbox-checked-text: #FFFFFF;
    --dws-focus-ring-primary: rgba(196, 143, 86, 0.4);
    --dws-focus-ring-button: rgba(45, 55, 72, 0.4);
    --dws-form-font-family: 'Montserrat', sans-serif;
    --dws-form-base-font-size: 16px;
}

/* Conteneur principal */
.dws-smart-search-tailwind-container { 
    font-family: var(--dws-form-font-family); 
    background-color: #f9fafb; 
    padding: 1.5rem; 
    border-radius: 0.75rem; 
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); 
    font-size: var(--dws-form-base-font-size); 
    max-width: 1280px; 
    margin-left: auto; 
    margin-right: auto; 
}
@media (min-width: 768px) { .dws-smart-search-tailwind-container { padding: 2.5rem; } }

/* Titres */
.dws-main-title { color: var(--dws-secondary-color); font-weight: 800 !important; margin-bottom: 0.5rem !important; font-size: 2.25rem; }
.dws-main-subtitle { color: #4b5563; font-size: 1.125em; margin-bottom: 2.5rem !important; }

/* Sections */
.dws-form-section { background-color: #ffffff; border: 1px solid #e5e7eb; border-radius: 0.75rem; padding: 1.75rem; margin-bottom: 2.5rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.07); }
.dws-form-section-title { color: var(--dws-secondary-color) !important; border-bottom: 3px solid var(--dws-primary-color); display: flex; align-items: center; font-weight: 700; font-size: 1.35em; padding-bottom: 0.85rem; margin-bottom: 1.75rem; }
.dws-form-section-title svg { margin-right: 0.85rem; color: var(--dws-primary-color); width: 1.5em; height: 1.5em; }

/* Champs de formulaire (select, input) */
.dws-select-wrapper { position: relative; display: flex; align-items: center; }
.dws-select { border-color: #d1d5db; padding: 0.85rem 1.1rem; transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; width: 100%; border-radius: 0.5rem; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); font-size: 1em; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-position: right 0.75rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-right: 3rem; }
.dws-select-wrapper .dws-spinner { position: absolute; right: 3rem; top: 50%; transform: translateY(-50%); width: 1.35rem; height: 1.35rem; border: 3px solid rgba(0,0,0,0.1); border-left-color: var(--dws-primary-color); border-radius: 50%; animation: dws-spin 1s linear infinite; display: none; }
.dws-select-wrapper.loading .dws-select { color: #9ca3af; }
.dws-select-wrapper.loading .dws-spinner { display: block; }
@keyframes dws-spin { 0% { transform: translateY(-50%) rotate(0deg); } 100% { transform: translateY(-50%) rotate(360deg); } }

.dws-input { border-color: #d1d5db; padding: 0.85rem 1.1rem; transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; width: 100%; border-radius: 0.5rem; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); font-size: 1em; }
.dws-input:focus, .dws-select:focus { outline: 2px solid transparent; outline-offset: 2px; border-color: var(--dws-primary-color) !important; box-shadow: 0 0 0 4px var(--dws-focus-ring-primary) !important; }
.dws-select:disabled { background-color: #f3f4f6; cursor: not-allowed; opacity: 0.6;}
label { font-size: 0.95em; color: #374151; font-weight: 600; display: inline-flex; align-items: center; }
.text-sm { font-size: 0.875em; }

/* Checkboxes d'équipement */
.dws-checkbox-label-wrapper { position: relative; }
.dws-checkbox-label { border: 2px solid #e5e7eb; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); color: #374151; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%; height: 100%; padding: 1rem; border-radius: 0.6rem; box-shadow: 0 2px 4px 0 rgba(0,0,0,0.05); cursor: pointer; font-weight: 600; background-color: #fff; }
.dws-checkbox-label:hover { border-color: var(--dws-primary-color); background-color: #fffcf7; transform: translateY(-2px); box-shadow: 0 4px 8px 0 rgba(0,0,0,0.07); }
input[type="checkbox"].dws-equip-checkbox:checked + .dws-checkbox-label { background-color: var(--dws-checkbox-checked-bg); border-color: var(--dws-checkbox-checked-border); color: var(--dws-checkbox-checked-text); box-shadow: 0 4px 10px -2px var(--dws-focus-ring-primary); }
input[type="checkbox"].dws-equip-checkbox:checked + .dws-checkbox-label svg.checkbox-tick { display: block; color: var(--dws-checkbox-checked-text); position: absolute; top: 0.6rem; right: 0.6rem; width: 1.6em; height: 1.6em; }
input[type="checkbox"].dws-equip-checkbox:focus + .dws-checkbox-label { outline: 2px solid transparent; outline-offset: 2px; box-shadow: 0 0 0 4px var(--dws-focus-ring-primary); }
.dws-checkbox-label img.equip-image { width: 100%; height: 100px; object-fit: cover; margin-bottom: 0.75rem; border-radius: 0.375rem; display: none; border: 1px solid #eee; }
.dws-checkbox-label .dws-checkbox-label-text { font-size: 0.95em; line-height: 1.3; display: flex; align-items: center; justify-content: center; }
.dws-checkbox-label svg.checkbox-tick { display: none; }
input[type="checkbox"].dws-equip-checkbox { opacity: 0; position: absolute; width: 1px; height: 1px; }
.dws-simple-equip-desc { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-8px); background-color: var(--dws-secondary-color); color: white; padding: 0.6rem 0.8rem; border-radius: 0.375rem; font-size: 0.8em; width: max-content; max-width: 220px; text-align: center; z-index: 20; box-shadow: 0 3px 8px rgba(0,0,0,0.25); }
.mode-simple .dws-checkbox-label-wrapper:hover .dws-simple-equip-desc { display: block; }
.dws-expert-equip-icon { width: 1.2em; height: 1.2em; margin-right: 0.5em; vertical-align: text-bottom; color: var(--dws-secondary-color); flex-shrink: 0; }

/* Boutons */
.dws-btn { padding: 0.85rem 2rem; font-weight: 700; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); text-transform: uppercase; letter-spacing: 0.06em; border-radius: 0.5rem; box-shadow: 0 2px 5px 0 rgba(0,0,0,0.1), 0 1px 3px 0 rgba(0,0,0,0.08); display: inline-flex; align-items: center; justify-content: center; font-size: 0.9em; line-height: 1.2; border: 2px solid transparent; cursor: pointer; }
.dws-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.dws-btn svg { margin-right: 0.6rem; width: 1.2em; height: 1.2em; }
.dws-btn .dws-spinner { margin-right: 0.6rem; border-color: rgba(255,255,255,0.4); border-left-color: #fff; animation: dws-spin 1s linear infinite; width: 1.2em; height: 1.2em; border-radius: 50%; display: inline-block; }
.dws-btn-primary { background-color: var(--dws-button-bg); color: var(--dws-text-on-accent); }
.dws-btn-primary:hover:not(:disabled) { background-color: var(--dws-button-hover-bg); transform: translateY(-2px); }
.dws-btn-secondary { color: var(--dws-primary-color); background-color: white; border-color: var(--dws-primary-color); }
.dws-btn-secondary:hover:not(:disabled) { background-color: #fefcfa; color: #A07646; border-color: #A07646; transform: translateY(-2px); }
.dws-btn-catalogue { background-color: #10B981; color: white; }
.dws-btn-catalogue:hover:not(:disabled) { background-color: #059669; transform: translateY(-2px); }
.dws-btn-rappel { background-color: var(--dws-primary-color); color: var(--dws-text-on-accent); }
.dws-btn-rappel:hover:not(:disabled) { background-color: #A07646; transform: translateY(-2px); }
.dws-btn-gallery { background-color: #6B7280; color: white; }
.dws-btn-gallery:hover:not(:disabled) { background-color: #4B5563; transform: translateY(-2px); }


/* Erreurs et messages */
.dws-error-msg { font-size: 0.9em; margin-top: 0.35rem; color: #DC2626; display: none; }
.dws-error-field { border-color: #DC2626 !important; }
.dws-label-error { color: #DC2626 !important; }
#dws-global-form-error-area { display: none; background-color: #FEF2F2; color: #B91C1C; border: 1px solid #FCA5A5; padding: 1.25rem; border-radius: 0.5rem; font-size: 1em; }
#equipements-message { display: none; background-color: #EFF6FF; border-left: 4px solid #3B82F6; color: #1E40AF; padding: 0.85rem 1.1rem; margin-top: 1.25rem; border-radius: 0.375rem; font-size: 0.9em; }
#dws-equipements-counter { font-size: 0.9em; color: var(--dws-secondary-color); margin-left: 0.5rem; font-weight: 500; }

/* Switcher de mode */
.mode-switcher { display: flex; justify-content: center; align-items: center; background-color: #e5e7eb; border-radius: 0.5rem; padding: 0.35rem; margin-bottom: 2.5rem; width: fit-content; margin-left: auto; margin-right: auto; }
.mode-switcher label { padding: 0.6rem 1.5rem; border-radius: 0.375rem; cursor: pointer; transition: all 0.25s; font-weight: 600; color: #4b5563; font-size: 1em; }
.mode-switcher input[type="radio"] { display: none; }
.mode-switcher input[type="radio"]:checked + label { background-color: var(--dws-primary-color); color: var(--dws-text-on-accent); box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1); }

/* Visibilité des modes */
.dws-expert-only { transition: opacity 0.35s ease-out, max-height 0.35s ease-out, visibility 0.35s, margin 0.35s, padding 0.35s; }
.mode-simple .dws-expert-only { 
    opacity: 0; 
    max-height: 0 !important; 
    visibility: hidden; 
    margin-top: 0 !important; 
    margin-bottom: 0 !important; 
    padding-top: 0 !important; 
    padding-bottom: 0 !important; 
    border: none !important; 
    overflow: hidden; 
}
.mode-expert .dws-expert-only { opacity: 1; max-height: 2000px; visibility: visible; }

/* Grille des équipements */
.equip-grid { display: grid; gap: 1.25rem; }
.mode-simple .equip-grid .dws-checkbox-label img.equip-image { display: block; }
.mode-simple .equip-grid .dws-checkbox-label { min-height: 180px; padding: 0.85rem; }
.mode-simple .equip-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.mode-expert .equip-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mode-expert .equip-grid .dws-checkbox-label { min-height: auto; padding: 0.85rem 1.1rem; justify-content: flex-start; flex-direction: row; align-items: center; }
.mode-expert .equip-grid .dws-checkbox-label-text { font-size: 1em; flex-grow: 1; text-align: left; margin-left: 0.6rem; }
.mode-expert input[type="checkbox"].dws-equip-checkbox:checked + .dws-checkbox-label svg.checkbox-tick { position: static; display: inline-block !important; margin-left: auto; }

/* Image métier */
#dws-metier-image-container { margin-top: 1.75rem; text-align: center; }
#dws-metier-image { max-width: 100%; height: auto; max-height: 280px; border-radius: 0.5rem; box-shadow: 0 3px 6px rgba(0,0,0,0.12); display: none; margin: 0 auto; border: 1px solid #ddd;}

/* Responsive */
@media (max-width: 767px) {
    .mode-switcher { display: none !important; }
    .dws-smart-search-tailwind-container.mode-expert .dws-expert-only { display: none !important; }
    .dws-smart-search-tailwind-container .dws-expert-only { display: none !important; }
    .dws-simple-equip-desc { display: none !important; }
    .dws-btn { width: 100%; margin-bottom: 0.75rem; }
}

/* Modale de Rappel */
.dws-rappel-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.65); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 1rem; }
.dws-rappel-modal-content { background-color: white; padding: 2.5rem; border-radius: 0.75rem; box-shadow: 0 10px 25px rgba(0,0,0,0.3); width: 100%; max-width: 550px; position: relative; }
.dws-rappel-modal-close { position: absolute; top: 1rem; right: 1.25rem; font-size: 2rem; font-weight: bold; color: #9ca3af; cursor: pointer; line-height: 1; }
#dws-rappel-feedback { margin-top: 1.25rem; font-size: 0.95em; text-align: center; font-weight: bold; }
#dws-rappel-feedback.success { color: #059669; }
#dws-rappel-feedback.error { color: #DC2626; }
/* Style pour le calendrier Flatpickr */
.flatpickr-calendar { z-index: 1001 !important; }

/* Engagements */
.dws-engagements-section { background-color: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 0.75rem; padding: 1.75rem; margin-top: 2.5rem; text-align: center; }

/* Auto-complétion */
#vehicle_search_suggestions { position: absolute; z-index: 10; width: 100%; background-color: white; border: 1px solid #d1d5db; border-radius: 0.5rem; margin-top: 0.25rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); display: none; }
#vehicle_search_suggestions .suggestion-item { padding: 10px 15px; cursor: pointer; transition: background-color 0.2s; }
#vehicle_search_suggestions .suggestion-item:hover,
#vehicle_search_suggestions .suggestion-item.active { background-color: #f3f4f6; }
#vehicle_search_suggestions .suggestion-item strong { color: var(--dws-primary-color); }

/* --- Styles pour l'aide à la dimension --- */
.dws-dimension-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--dws-secondary-color);
    color: white;
    font-weight: bold;
    font-size: 14px;
    margin-left: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    user-select: none;
}

.dws-dimension-help-icon:hover {
    background-color: var(--dws-primary-color);
    transform: scale(1.1);
}

.dws-dimension-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Caché par défaut */
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Au-dessus de tout le reste */
    padding: 1rem;
    overflow-y: auto;
}

.dws-dimension-modal-content {
    background-color: white;
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 900px; /* Plus large pour les images */
    position: relative;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.dws-dimension-modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 2rem;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.dws-dimension-modal-close:hover {
    color: #374151;
}

.dws-dimension-modal-body {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.dws-dimension-schema {
    flex-basis: calc(50% - 1rem); /* Deux par ligne sur grand écran */
    text-align: center;
}

.dws-dimension-schema img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    border: 1px solid #ddd;
    margin-bottom: 0.75rem;
}

.dws-dimension-schema p {
    font-size: 1em;
    color: #374151;
}

@media (max-width: 768px) {
    .dws-dimension-schema {
        flex-basis: 100%; /* Une par ligne sur petit écran */
    }
}
