/**
 * Styles pour le module GeoElements
 * - Bottom panel accordéon
 * - Overlay de dessin sur la carte
 * - Mise en évidence des éléments
 */

/* ============================
   BOTTOM PANEL - GEO ELEMENTS
   ============================ */

.geo-elements-panel {
    padding: 0;
}

.geo-elements-panel .no-elements-message {
    padding: 30px 20px;
    text-align: center;
    color: #999;
}

.geo-elements-panel .no-elements-message .fas {
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Accordéon */
.geo-elements-list {
    margin: 0;
}

.geo-element-item {
    margin-bottom: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.geo-element-item:first-child {
    border-top: none;
}

.geo-element-item.is-new {
    border-left: 3px solid #5bc0de;
}

.geo-element-item.is-new .panel-heading {
    background-color: #f0f9fc;
}

/* Header de l'accordéon */
.geo-element-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    transition: background-color 0.15s ease;
}

.geo-element-header:hover {
    background-color: #f5f5f5;
}

.geo-element-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Toggle icon */
.geo-element-toggle {
    width: 16px;
    color: #999;
    flex-shrink: 0;
}

.geo-element-toggle .expanded-icon {
    display: none;
}

.geo-element-item.expanded .geo-element-toggle .collapsed-icon {
    display: none;
}

.geo-element-item.expanded .geo-element-toggle .expanded-icon {
    display: inline;
}

/* Color dot */
.geo-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Nom de l'élément */
.geo-element-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.geo-element-name em {
    color: #999;
    font-weight: normal;
}

/* Badge type */
.geo-element-type {
    font-size: 0.75em;
    font-weight: normal;
    padding: 2px 6px;
    background-color: #e9ecef;
    color: #666;
    flex-shrink: 0;
}

/* Actions dans le header */
.geo-element-actions {
    flex-shrink: 0;
    margin-left: 10px;
}

.geo-element-actions .btn {
    padding: 2px 6px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.geo-element-header:hover .geo-element-actions .btn {
    opacity: 1;
}

/* Body de l'accordéon */
.geo-element-body {
    border-top: 1px solid #ddd;
    background-color: #fafafa;
}

.geo-element-form {
    padding: 15px;
}

.geo-element-form .form-group {
    margin-bottom: 12px;
}

.geo-element-form .form-group:last-child {
    margin-bottom: 0;
}

.geo-element-form .control-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

/* Statut de la géométrie */
.geo-geometry-status {
    padding: 8px 0;
    font-size: 0.9em;
    min-height: 34px;
}

.geo-geometry-status .fas {
    margin-right: 5px;
}

/* Actions du formulaire */
.geo-element-form-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* Highlight sur hover */
.geo-element-item:hover:not(.expanded) {
    background-color: #fafafa;
}

.geo-element-item.highlighted {
    background-color: #fff3cd;
}

.geo-element-item.highlighted .panel-heading {
    background-color: #fff3cd;
}

/* ============================
   OVERLAY DESSIN - SUR LA CARTE
   ============================ */

.geo-draw-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    pointer-events: auto;
}

.geo-draw-overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.geo-draw-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.geo-draw-icon {
    font-size: 1.3em;
}

.geo-draw-type-label {
    font-weight: 500;
    color: #333;
}

.geo-draw-type-value {
    font-weight: bold;
    color: #3388ff;
}

.geo-draw-instructions {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    line-height: 1.4;
}

.geo-draw-instructions .fas {
    margin-right: 5px;
    color: #999;
}

.geo-draw-progress {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.geo-draw-progress strong {
    color: #333;
}

.geo-draw-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Curseur carte en mode dessin */
.geo-map-container.drawing-mode {
    cursor: crosshair !important;
}

.geo-map-container.drawing-mode * {
    cursor: crosshair !important;
}

/* ============================
   INPUT TYPE DÉSACTIVÉ
   ============================ */

.geo-input-type:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ============================
   COULEUR PICKER
   ============================ */

.geo-input-color {
    cursor: pointer;
}

.geo-color-preview {
    vertical-align: middle;
    margin-right: 8px;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 767px) {
    .geo-element-header-content {
        flex-wrap: wrap;
    }
    
    .geo-element-name {
        order: 1;
        width: calc(100% - 50px);
    }
    
    .geo-element-type {
        order: 3;
        margin-top: 5px;
    }
    
    .geo-draw-overlay-content {
        padding: 10px;
    }
    
    .geo-draw-info {
        flex-wrap: wrap;
    }
    
    .geo-draw-actions {
        flex-direction: column;
    }
    
    .geo-draw-actions .btn {
        width: 100%;
    }
}

/* ============================
   PANEL HEADER (si affiché)
   ============================ */

.panel[data-name="geoElements"] > .panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel[data-name="geoElements"] > .panel-heading .btn-group {
    margin-left: auto;
}

/* Bouton d'ajout dans le header du panel */
.panel[data-name="geoElements"] .btn-add-geo-element {
    padding: 2px 8px;
    font-size: 0.85em;
}

/* ============================
   ANIMATIONS
   ============================ */

.geo-element-body {
    transition: none; /* jQuery slideDown/slideUp gère l'animation */
}

.geo-element-item {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ============================
   ÉTATS SPÉCIAUX
   ============================ */

/* Élément en cours de dessin */
.geo-element-item.is-drawing {
    border-left-color: #28a745;
}

.geo-element-item.is-drawing .panel-heading {
    background-color: #d4edda;
}

/* Élément avec erreur */
.geo-element-item.has-error {
    border-left-color: #dc3545;
}

.geo-element-item.has-error .panel-heading {
    background-color: #f8d7da;
}

/* ============================
   MARKER SUR LA CARTE (highlight)
   ============================ */

.geo-element-layer-highlighted {
    filter: brightness(1.2);
}

/* Popup personnalisé */
.geo-element-popup .leaflet-popup-content {
    margin: 10px 15px;
}

.geo-element-popup .geo-popup-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.geo-element-popup .geo-popup-type {
    font-size: 0.85em;
    color: #666;
}
