/**
 * @file app/modules/Signalement/assets/css/signalement.css
 * @description Styles spécifiques au module Signalement (formulaire public, autocomplétion, carte, upload de photos).
 * Styles mis à jour pour MapLibre GL.
 */

/* -- Conteneur principal -- */
.signalement-container {
    max-width: 1200px;
    margin: 30px auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 25px;
    box-sizing: border-box;
}

.signalement-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2.2rem;
}

.signalement-container .intro-message {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* -- Étapes du formulaire -- */
.form-steps {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.form-step {
    padding: 20px 0;
}

.form-step h2 {
    color: var(--secondary-color);
    font-size: 1.6rem;
    margin-bottom: 25px;
    text-align: center;
}

/* -- Étape 1 : Sélection de catégorie -- */
.choix-categorie {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.choix-categorie .category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 120px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.choix-categorie .category-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.choix-categorie .category-item:hover,
.choix-categorie .category-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.2);
    transform: translateY(-3px);
}

.choix-categorie .category-item.selected {
    background-color: var(--primary-color);
    color: #fff;
}

.choix-categorie .category-item.selected img {
    filter: brightness(0) invert(1);
}

/* -- Styles généraux des formulaires -- */
.form-group {
    margin-bottom: 20px;
    position: relative; /* Contexte de positionnement pour l'autocomplétion */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
}

/* Style unifié pour tous les champs de formulaire */
.form-group select,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group select:focus,
.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group textarea:focus {
    border-color: var(--primary-color, #007bff);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
}

/* Style spécifique pour les select avec un chevron custom */
.form-group select {
    background: url('/MonAppli_V2_1/app/assets/images/select-chevron.png') no-repeat right 12px center / 22px, #fff;
    padding-right: 42px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-group .required {
    color: #dc3545;
    font-weight: bold;
}

.form-group .error-text {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* -- Autocomplétion d'adresse -- */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #bbb;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #bbb #fff;
}

.autocomplete-list::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-list::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.autocomplete-list li {
    padding: 8px 12px;
    cursor: pointer;
}

.autocomplete-list li:hover {
    background: #f0f0f0;
}

/* -- Section d'upload de photos -- */
input[type="file"] {
    display: none;
}

.photos-upload-group {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.photo-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    border: 1.5px dashed #aaa;
    min-width: 160px;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    margin: 0;
}

.photo-upload-label:hover {
    border-color: var(--primary-color, #007bff);
    background: #f0f7ff;
}

.photo-upload-label .photo-upload-icon {
    width: 32px;
    height: 32px;
    display: block;
}

#photos-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 34px;
}

.photo-thumb-container {
    position: relative;
    display: inline-block;
}

.photo-thumb-container img,
#photos-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
    background: #fff;
}

.photo-remove-btn {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #dc3545;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s, transform 0.2s;
}

.photo-remove-btn:hover {
    background: #a31928;
    transform: scale(1.1);
}

.add-more-photo {
    background: var(--primary-color, #007bff);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-left: 8px;
    margin-top: 2px;
}

.add-more-photo:hover {
    background: #0056b3;
}

/* -- Carte & Barre de progression -- */
#signalementMap {
    height: 400px;
    width: 100%;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 5px;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
}
/* Style de base pour TOUS les boutons sur la carte (cohérence) */
.map-button {
    position: absolute;
    z-index: 1000; /* Pour être au-dessus de la carte */
    background-color: white;
    border: none;
    border-radius: 50%; /* Pour un bouton rond */
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    width: 40px; /* Taille du bouton */
    height: 40px;
    padding: 0; /* Important pour le centrage */
    
    /* La magie du centrage de l'icône */
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: background-color 0.2s;
}
.map-button:hover {
    background-color: #f4f4f4;
}

/* Style pour l'image à l'intérieur du bouton */
.map-button img {
    width: 40px; /* Taille de l'icône, plus petite que le bouton */
    height: 40px;
}

/* Positionnement spécifique du bouton de géolocalisation */
.geolocate-btn {
    top: 65px;
    left: 10px;
}

/* Positionnement spécifique du bouton de changement de vue */
.layer-switch-btn {
    top: 15px;
    right: 10px;
    font-size: 1.5rem; /* Augmente la taille de l'émoji */
}
/* --- Styles spécifiques pour MapLibre GL --- */
/* Marqueur personnalisé */
.custom-map-marker {
    background-repeat: no-repeat;
    background-position: center;
    width: 42px;
    height: 42px;
}

/* Conteneur des boutons custom */
.map-geolocate-btn,
.map-layer-switcher {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 6px;
    position: absolute; /* Positionnement absolu dans le conteneur de la carte */
    z-index: 10;
}

/* Bouton de géolocalisation */
.map-geolocate-btn {
    top: 65px;
    left: 10px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.map-geolocate-btn:hover {
    background-color: #f0f0f0;
}

.map-geolocate-btn img {
    width: 100%;
    height: 100%;
}

/* Sélecteur de calque */
.map-layer-switcher {
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
}

.map-layer-switcher button {
    border: none;
    background: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.map-layer-switcher button:hover {
    background-color: #f0f0f0;
}

.map-layer-switcher button.active {
    background-color: var(--primary-color, #007bff);
    color: #fff;
    pointer-events: none; /* Empêche le clic si déjà actif */
}


/* -- Barre de progression (ancienne version, si conservée) -- */
.upload-progress {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 5px;
    margin-top: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
}

.upload-progress .progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.upload-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* -- Boutons de navigation -- */
.form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

.form-navigation .button {
    flex: 1;
}

/* ===== MODALE DE CONFIRMATION LOCALISATION ===== */
#confirm-localisation-modal.modal-overlay {
    position: fixed; top:0; left:0; width:100vw; height:100vh;
    background: rgba(30, 40, 80, 0.35);
    z-index: 9001; display: flex; align-items: center; justify-content: center;
}
#confirm-localisation-modal .modal-box {
    background: #fff; border-radius: 18px; max-width: 380px; width: 92%;
    box-shadow: 0 8px 32px rgba(40, 40, 80, 0.22);
    padding: 28px 26px 22px 26px; text-align: center;
    position: relative; animation: popin 0.18s;
}
@keyframes popin { from { transform: scale(0.92); opacity:0.3; } to { transform: scale(1); opacity:1; } }
#confirm-localisation-modal .modal-box h2 { margin-bottom: 12px; font-size: 1.3em; color: #20609a;}
#confirm-localisation-modal .modal-actions { margin-top: 20px; display:flex; gap:18px; justify-content:center; }
#confirm-localisation-modal .btn {
    padding: 10px 18px; font-size:1em; border:none; border-radius:8px; cursor:pointer; transition:.16s;
}
#confirm-localisation-modal .btn-confirm-location { background: #2eac55; color: #fff; }
#confirm-localisation-modal .btn-cancel-location  { background: #e14a4a; color: #fff; }
#confirm-localisation-modal .btn:hover { opacity: 0.88; }

/* --- Autocomplétion d'adresse --- */
.autocomplete-container {
    position: relative; /* Point d'ancrage pour la liste */
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #bbb;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.autocomplete-list li {
    padding: 8px 12px;
    cursor: pointer;
}

.autocomplete-list li:hover {
    background: #f0f0f0;
}

/* -- Message de confirmation (Étape finale) -- */
.confirmation-message {
    text-align: center;
    padding: 40px 20px;
    background-color: #e2f4f8;
    border: 1px solid #b3e0ed;
    border-radius: 8px;
    color: #333;
}

.confirmation-message p {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.confirmation-message strong {
    color: var(--primary-color);
    font-size: 1.5rem;
    display: block;
    margin-top: 10px;
}

/* -- Media Queries pour le responsive -- */
@media (max-width: 700px) {
    .signalement-container {
        padding: 15px;
        margin: 15px auto;
    }

    .choix-categorie {
        gap: 10px;
    }

    .choix-categorie .category-item {
        width: calc(33.33% - 10px);
        height: auto;
        padding: 10px 5px;
        font-size: 0.75rem;
    }

    .choix-categorie .category-item img {
        width: 40px;
        height: 40px;
    }

    .photo-thumb-container img,
    #photos-preview img {
        width: 48px;
        height: 48px;
    }

    .form-navigation {
        flex-direction: column;
    }
}