/* Styles pour le widget géolocalisation - Version refondue */

.geolocation-widget {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    background: #ffffff;
    margin-bottom: 1rem;
}

/* En-tête avec indicateur de statut */
.geolocation-header {
    margin-bottom: 1rem;
}

.location-summary[hidden],
.map-section[hidden],
.geolocation-status-indicator[hidden] {
    display: none !important;
}

.geolocation-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.geolocation-status-indicator.is-neutral {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.geolocation-status-indicator.is-error,
.geolocation-status-indicator.text-red-600 {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.geolocation-status-indicator.is-success,
.geolocation-status-indicator.text-green-700 {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.status-icon {
    font-size: 1rem;
}

.status-text {
    flex: 1;
}

/* Carte interactive (élément principal) */
.map-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: #fafaf9;
}

.geolocation-map {
    display: block;
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    min-height: 400px;
}

/* Zone de recherche d'adresse */
.search-zone {
    margin-bottom: 1rem;
    position: relative;
    padding: 1rem;
    border: 1px solid #dbeafe;
    border-radius: 1rem;
    background: #f8fbff;
}

.search-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input-group {
    position: relative;
    margin-top: 0.75rem;
}

.address-search {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.address-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
}

.search-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.search-btn:active {
    transform: translateY(0);
}

.search-helper {
    max-width: 38rem;
    line-height: 1.5;
}

/* Suggestions d'adresses */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.35rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    transition: background-color 0.15s ease-in-out;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.bg-gray-100 {
    background-color: #f3f4f6;
}

.suggestion-item.font-semibold {
    font-weight: 600;
}

.location-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 1rem;
    background: #eff6ff;
}

.location-summary-content {
    min-width: 0;
}

.location-summary-kicker,
.map-entry-kicker,
.map-section-kicker {
    margin: 0 0 0.25rem 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2563eb;
}

.location-summary-text,
.map-section-title,
.map-entry-text {
    margin: 0;
    color: #0f172a;
}

.location-summary-text {
    font-size: 1rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.location-summary-meta,
.map-helper {
    margin: 0.35rem 0 0 0;
    line-height: 1.5;
}

.map-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid #2563eb;
    border-radius: 9999px;
    background: #2563eb;
    color: #ffffff;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, transform 0.15s ease-in-out;
    white-space: nowrap;
}

.map-toggle-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

.map-toggle-btn-secondary {
    background: #ffffff;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.map-toggle-btn-secondary:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.map-entry-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 1rem;
    background: #ffffff;
}

.map-entry-copy {
    min-width: 0;
}

.map-entry-text {
    line-height: 1.5;
    color: #475569;
}

.map-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.map-section-copy {
    min-width: 0;
}

.map-section-title {
    font-size: 1rem;
    font-weight: 600;
}

/* Champs d'adresse éditables */
.address-fields {
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Affichage des coordonnées */
.coordinates-display {
    padding: 0.75rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.coordinates-display .flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* État de géolocalisation (messages) */
.geolocation-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.geolocation-status.loading {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.geolocation-status.success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.geolocation-status.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Grille pour les champs côte à côte */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gap-4 {
    gap: 1rem;
}

/* Utilitaires */
.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.font-medium {
    font-weight: 500;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (max-width: 1023px) {
    .geolocation-widget {
        padding: 1rem;
        border-radius: 1rem;
    }

    .search-zone,
    .location-summary,
    .map-entry-card,
    .map-section {
        border-radius: 0.875rem;
    }

    .geolocation-map {
        min-height: 280px;
    }

    .search-input {
        flex-direction: column;
        align-items: stretch;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .location-summary,
    .map-entry-card,
    .map-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .map-toggle-btn,
    .map-toggle-btn-secondary {
        width: 100%;
    }

    .coordinates-display .flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .grid-cols-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767px) {
    .geolocation-map {
        min-height: 260px;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .status-text {
        line-height: 1.4;
    }
}
