/* ========================================
   ESTIMDVF CSS - VERSION OPTIMISÉE
   Fond uniforme #0f172a + Thème sombre cohérent
   ======================================== */

/* ========================================
   1. RESET & BASE
   ======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f172a;
    color: #f1f5f9;
    min-height: 100vh;
    padding: 0;
}

/* ========================================
   2. WORDPRESS OVERRIDES (Pleine largeur)
   ======================================== */

/* Neutraliser les contraintes WordPress */
body.page-template-index-wordpress-php,
body.page-template-default,
body.page,
#page.site,
#content-wrapper.container.row {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

/* Supprimer les titres de page WordPress */
.entry-header,
.page-header,
h1.entry-title {
    display: none !important;
}

/* Containers WordPress en pleine largeur */
.site-content,
.content-area,
main,
article,
.entry-content,
#primary,
#main,
.site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* ========================================
   3. WRAPPER PRINCIPAL
   ======================================== */

/* Wrapper pleine largeur (WordPress) */
.estimdvf-fullwidth,
.estimdvf-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    background: #0f172a !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    position: relative !important;
    color: #f1f5f9 !important;
    padding: 0 !important;
}

.estimdvf-fullwidth *,
.estimdvf-wrapper * {
    box-sizing: border-box !important;
}

/* Container interne avec padding */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.estimdvf-fullwidth .container,
.estimdvf-wrapper .container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 2rem 1rem !important;
}

/* ========================================
   4. HEADER
   ======================================== */

header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: #94a3b8;
    font-weight: 300;
}

/* ========================================
   5. CARDS & CONTAINERS
   ======================================== */

.glass-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   6. FORMULAIRES & INPUTS
   ======================================== */

/* Labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #cbd5e1;
}

/* Tous les inputs, selects, textarea */
.input-field,
input[type="text"],
input[type="number"],
select,
textarea,
.estimdvf-fullwidth input[type="text"],
.estimdvf-fullwidth input[type="number"],
.estimdvf-fullwidth select,
.estimdvf-fullwidth textarea,
.estimdvf-wrapper input[type="text"],
.estimdvf-wrapper input[type="number"],
.estimdvf-wrapper select,
.estimdvf-wrapper textarea {
    background: rgba(15, 23, 42, 0.5) !important;
    border: 2px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 12px !important;
    padding: 1rem 1.25rem !important;
    color: #f1f5f9 !important;
    font-size: 1rem !important;
    font-family: 'Outfit', -apple-system, sans-serif !important;
    width: 100%;
    transition: all 0.3s ease;
    line-height: 1.5 !important;
}

.input-field:focus,
input:focus,
select:focus,
textarea:focus,
.estimdvf-fullwidth input:focus,
.estimdvf-fullwidth select:focus,
.estimdvf-fullwidth textarea:focus,
.estimdvf-wrapper input:focus,
.estimdvf-wrapper select:focus,
.estimdvf-wrapper textarea:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    background: rgba(15, 23, 42, 0.8) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1) !important;
}

.input-field::placeholder,
input::placeholder,
textarea::placeholder,
.estimdvf-fullwidth input::placeholder,
.estimdvf-fullwidth textarea::placeholder,
.estimdvf-wrapper input::placeholder,
.estimdvf-wrapper textarea::placeholder {
    color: #64748b !important;
}

/* Input adresse avec icône */
.autocomplete-container,
.estimdvf-fullwidth .autocomplete-container,
.estimdvf-wrapper .autocomplete-container {
    position: relative !important;
}

.search-icon,
.estimdvf-fullwidth .search-icon,
.estimdvf-wrapper .search-icon {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #64748b !important;
    pointer-events: none !important;
    font-size: 1.25rem !important;
}

#addressInput,
.estimdvf-fullwidth #addressInput,
.estimdvf-wrapper #addressInput {
    padding-left: 2.5rem !important;
}

/* Grilles pour formulaires */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ========================================
   7. BOUTONS
   ======================================== */

button,
.estimdvf-fullwidth button,
.estimdvf-wrapper button {
    font-family: 'Outfit', -apple-system, sans-serif !important;
    cursor: pointer !important;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.button-group {
    display: flex;
    gap: 1rem;
}

/* ========================================
   8. SYSTÈME D'ONGLETS
   ======================================== */

.onglets-container,
.estimdvf-fullwidth .onglets-container,
.estimdvf-wrapper .onglets-container {
    background: rgba(30, 41, 59, 0.8) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    overflow: hidden !important;
    margin-top: 40px !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
}

.onglets-nav,
.estimdvf-fullwidth .onglets-nav,
.estimdvf-wrapper .onglets-nav {
    padding: 20px 20px 0 20px !important;
    background: rgba(15, 23, 42, 0.9) !important;
    display: flex !important;
    gap: 10px !important;
    border-bottom: 2px solid rgba(148, 163, 184, 0.2) !important;
}

.onglet-btn,
.estimdvf-fullwidth .onglet-btn,
.estimdvf-wrapper .onglet-btn {
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    padding: 12px 24px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    transition: all 0.3s ease !important;
}

.onglet-btn:hover,
.estimdvf-fullwidth .onglet-btn:hover,
.estimdvf-wrapper .onglet-btn:hover {
    color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

.onglet-btn.active,
.estimdvf-fullwidth .onglet-btn.active,
.estimdvf-wrapper .onglet-btn.active {
    color: #3b82f6 !important;
    border-bottom-color: #3b82f6 !important;
    background: rgba(30, 41, 59, 0.8) !important;
}

.onglets-content,
.estimdvf-fullwidth .onglets-content,
.estimdvf-wrapper .onglets-content {
    background: rgba(30, 41, 59, 0.8) !important;
}

.onglet-panel,
.estimdvf-fullwidth .onglet-panel,
.estimdvf-wrapper .onglet-panel {
    padding: 30px !important;
    animation: fadeIn 0.3s ease !important;
    color: #f1f5f9 !important;
}

.onglet-panel:not(.active),
.estimdvf-fullwidth .onglet-panel:not(.active),
.estimdvf-wrapper .onglet-panel:not(.active) {
    display: none !important;
}

/* ========================================
   9. MODULE STATISTIQUES
   ======================================== */

.stats-module,
.estimdvf-fullwidth .stats-module,
.estimdvf-wrapper .stats-module {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 16px !important;
    padding: 2rem !important;
    margin-top: 3rem !important;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
}

.stats-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-filter-small {
    background: rgba(15, 23, 42, 0.5);
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: #f1f5f9;
    font-size: 0.875rem;
    min-width: 120px;
}

/* Stats globales - Cartes */
.stats-global,
#statsGlobal,
.estimdvf-fullwidth .stats-global,
.estimdvf-fullwidth #statsGlobal,
.estimdvf-wrapper .stats-global,
.estimdvf-wrapper #statsGlobal {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 1.5rem !important;
    margin-bottom: 2rem !important;
}

.stats-global-card,
.estimdvf-fullwidth .stats-global-card,
.estimdvf-wrapper .stats-global-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    text-align: center !important;
}

.stats-global-label,
.estimdvf-fullwidth .stats-global-label,
.estimdvf-wrapper .stats-global-label {
    font-size: 0.875rem !important;
    color: #94a3b8 !important;
    margin-bottom: 0.5rem !important;
}

.stats-global-value,
.estimdvf-fullwidth .stats-global-value,
.estimdvf-wrapper .stats-global-value {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    font-family: 'JetBrains Mono', monospace !important;
    color: #3b82f6 !important;
}

/* ========================================
   TABLEAU STATISTIQUES - STYLE IMAGE 2
   ======================================== */

.stats-table-container {
    overflow-x: auto;
    border-radius: 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 0;
}

.stats-table, 
#statsTable,
.estimdvf-fullwidth #statsTable,
.estimdvf-wrapper #statsTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
    min-width: 900px;
}

/* En-tête avec fond bleu uni */
.stats-table thead,
#statsTable thead,
.estimdvf-fullwidth #statsTable thead,
.estimdvf-wrapper #statsTable thead {
    background: #3275f1 !important;
}

.stats-table th {
    background: #3275f1;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: none;
    padding: 1.25rem 1rem;
    text-align: center;
    border: none;
}

.stats-table th:first-child {
    text-align: left;
    padding-left: 1.5rem;
}

#statsTable th,
.estimdvf-fullwidth #statsTable th,
.estimdvf-wrapper #statsTable th {
    padding: 1.25rem 1rem !important;
    text-align: center !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    font-size: 0.9rem !important;
    text-transform: none !important;
    border: none !important;
    background: transparent !important;
}

/* Première colonne (Surface) */
.stats-table th:first-child,
#statsTable th:first-child {
    text-align: left !important;
    padding-left: 1.5rem !important;
}

/* Corps du tableau */
.stats-table tbody,
#statsTable tbody {
    background: rgba(15, 23, 42, 0.4) !important;
}

.stats-table td {
    padding: 1.25rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: #f1f5f9;
    vertical-align: top;
}

.stats-table td:first-child {
    text-align: left;
    padding-left: 1.5rem;
}

#statsTable td,
.estimdvf-fullwidth #statsTable td,
.estimdvf-wrapper #statsTable td {
    padding: 1.25rem 1rem !important;
    text-align: center !important;
    border: none !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
    background: transparent !important;
    color: #f1f5f9 !important;
    vertical-align: top !important;
}

/* Première colonne (étiquettes de surface) */
.stats-table td:first-child,
#statsTable td:first-child,
.stats-year {
    text-align: left !important;
    padding-left: 1.5rem !important;
    font-weight: 600 !important;
    color: #93c5fd !important;
    background: rgba(30, 41, 59, 0.6) !important;
}

/* Hover sur les lignes */
.stats-table tbody tr:hover,
#statsTable tbody tr:hover {
    background: rgba(59, 130, 246, 0.05) !important;
}

/* Dernière ligne sans bordure */
.stats-table tbody tr:last-child td,
#statsTable tbody tr:last-child td {
    border-bottom: none !important;
}

/* Structure du contenu des cellules */
.stats-cell-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Prix principal (gros) */
.stats-price-main {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    font-family: 'JetBrains Mono', monospace !important;
    color: #93c5fd !important;
}

/* Prix au m² (violet) */
.stats-price-m2 {
    font-size: 0.875rem !important;
    color: #c4b5fd !important;
    font-weight: 600 !important;
	margin-top: 0.25rem !important;
}

/* Détails (nombre de ventes + surface moy) */
.stats-details {
    font-size: 0.75rem !important;
    color: #64748b !important;
    line-height: 1.4 !important;
}

.stats-details div {
    margin-top: 0.125rem;
}

/* ========================================
   10. CARTES DE STATS
   ======================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: #3b82f6;
}

/* ========================================
   ESTIMATION DU BIEN - DISPOSITION EN LIGNE
   ======================================== */

/* Container principal de l'estimation */
.estimation-container {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Grille pour l'estimation générale (4 cartes en ligne) */
.estimation-generale {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 2rem !important;
}

/* Grille pour l'estimation spécifique (2 cartes en ligne) */
.estimation-specifique {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
}

/* Cartes d'estimation */
.estimation-card {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 2px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    text-align: center !important;
    transition: all 0.3s ease;
}

.estimation-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

/* Carte active (bordure rouge) */
.estimation-card.active {
    border-color: #ef4444 !important;
    border-width: 3px !important;
}

/* Étiquette du type (BASSE, MOYENNE, etc.) */
.estimation-label {
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    margin-bottom: 0.75rem !important;
}

/* Prix principal */
.estimation-price {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: #f1f5f9 !important;
    font-family: 'JetBrains Mono', monospace !important;
    margin-bottom: 0.5rem !important;
}

/* Prix au m² */
.estimation-price-m2 {
    font-size: 0.875rem !important;
    color: #64748b !important;
}

.estimation-badge {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.estimation-value {
    font-size: 22px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.estimation-detail {
    font-size: 13px;
    color: #64748b;
}

/* Fourchette recommandée (encart à droite) */
.fourchette-recommandee {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 2px solid rgba(236, 72, 153, 0.4) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    text-align: center !important;
}

.fourchette-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #ec4899;
    font-weight: 600;
    margin-bottom: 1rem;
}

.fourchette-range {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 1rem;
}

.fourchette-optimal {
    color: #10b981;
    font-size: 1rem;
}

/* Responsive pour estimation */
@media (max-width: 1024px) {
    .estimation-generale {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .estimation-generale,
    .estimation-specifique {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   11. SLIDERS & RANGE INPUTS
   ======================================== */

.slider-container {
    margin: 2rem 0;
}

.slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.slider-value {
    font-family: 'JetBrains Mono', monospace;
    color: #3b82f6;
    font-size: 1.25rem;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* ========================================
   12. CARTE LEAFLET
   ======================================== */

#map {
    height: 400px;
    border-radius: 12px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
}

/* ========================================
   13. ALERTES & MESSAGES
   ======================================== */

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* ========================================
   14. COORDONNÉES & AFFICHAGES
   ======================================== */

.coords-display {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coords-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.coords-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: #94a3b8;
}

/* ========================================
   15. ESTIMATIONS & BADGES
   ======================================== */

.estimation-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
}

.estimation-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.estimation-badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
}

/* ========================================
   16. TRANSACTIONS
   ======================================== */

.transactions-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.transaction-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.transaction-card:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(4px);
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.transaction-address {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.transaction-meta {
    font-size: 0.875rem;
    color: #94a3b8;
}

.transaction-type-badge {
    background: rgba(59, 130, 246, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.transaction-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.transaction-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.transaction-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* ========================================
   17. AUTOCOMPLETE
   ======================================== */

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
}

.autocomplete-results.hidden {
    display: none;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.autocomplete-item:hover {
    background: rgba(59, 130, 246, 0.2);
}

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

.autocomplete-label {
    font-weight: 500;
    color: #f1f5f9;
    font-size: 14px;
}

.autocomplete-context {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ========================================
   18. GRAPHIQUES
   ======================================== */

.chart-container {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

canvas {
    max-height: 300px;
}

.year-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.year-stat-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.year-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.year-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
}

.year-count {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ========================================
   19. LOADING & ANIMATIONS
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   20. UTILITAIRES
   ======================================== */

.hidden {
    display: none;
}

.info-section {
    text-align: center;
    margin-top: 3rem;
}

.info-section p {
    color: #94a3b8;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   21. RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .stats-global,
    #statsGlobal,
    .estimdvf-fullwidth #statsGlobal,
    .estimdvf-wrapper #statsGlobal {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .container,
    .estimdvf-fullwidth .container,
    .estimdvf-wrapper .container {
        padding: 1rem !important;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    /* Onglets en mode mobile */
    .onglets-nav,
    .estimdvf-fullwidth .onglets-nav,
    .estimdvf-wrapper .onglets-nav {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .onglet-btn,
    .estimdvf-fullwidth .onglet-btn,
    .estimdvf-wrapper .onglet-btn {
        width: 100% !important;
        text-align: left !important;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2) !important;
        border-left: 3px solid transparent !important;
    }
    
    .onglet-btn.active,
    .estimdvf-fullwidth .onglet-btn.active,
    .estimdvf-wrapper .onglet-btn.active {
        border-bottom-color: rgba(148, 163, 184, 0.2) !important;
        border-left-color: #3b82f6 !important;
    }
    
    /* Stats en mode mobile */
    .stats-global,
    #statsGlobal,
    .estimdvf-fullwidth #statsGlobal,
    .estimdvf-wrapper #statsGlobal {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-table th,
    .stats-table td,
    #statsTable th,
    #statsTable td,
    .estimdvf-fullwidth #statsTable th,
    .estimdvf-fullwidth #statsTable td,
    .estimdvf-wrapper #statsTable th,
    .estimdvf-wrapper #statsTable td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .stats-price-main {
        font-size: 0.9rem;
    }
    
    .stats-price-m2 {
        font-size: 0.75rem;
    }
    
    .transaction-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-global,
    #statsGlobal,
    .estimdvf-fullwidth #statsGlobal,
    .estimdvf-wrapper #statsGlobal {
        grid-template-columns: 1fr !important;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   CORRECTION STATS-GRID - LIGNE 113 du template
   ======================================== */

/* Forcer la grille horizontale pour les stats */
.stats-grid,
#statsGrid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
    margin: 2rem 0 !important;
}

.stats-grid > *,
#statsGrid > * {
    display: block !important;
    width: auto !important;
}

/* ========================================
   TABLEAU STATS ZONE - Ligne 178 du template
   Style de l'image 2
   ======================================== */

/* Container du tableau */
#statsZoneContainer {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 1.5rem;
}

/* Stats globales en haut (si présentes) */
#statsZoneContainer .stats-global,
#statsGlobal {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 1rem !important;
    padding: 1.5rem !important;
    margin: 0 !important;
    background: rgba(15, 23, 42, 0.4);
}

/* Tableau */
#statsZoneContainer table,
#statsTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
}

/* En-tête BLEU comme l'image */
#statsZoneContainer thead,
#statsTable thead {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}

#statsZoneContainer thead th,
#statsTable thead th {
    padding: 1.25rem 1rem !important;
    text-align: center !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    font-size: 0.9rem !important;
    border: none !important;
    background: transparent !important;
}

#statsZoneContainer thead th:first-child,
#statsTable thead th:first-child {
    text-align: left !important;
    padding-left: 1.5rem !important;
}

/* Corps du tableau */
#statsZoneContainer tbody,
#statsTable tbody {
    background: rgba(15, 23, 42, 0.4);
}

#statsZoneContainer tbody td,
#statsTable tbody td {
    padding: 1.25rem 1rem !important;
    text-align: center !important;
    border: none !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
    color: #f1f5f9 !important;
    background: transparent !important;
    vertical-align: top !important;
}

/* Première colonne (Surface) */
#statsZoneContainer tbody td:first-child,
#statsTable tbody td:first-child {
    text-align: left !important;
    padding-left: 1.5rem !important;
    font-weight: 600 !important;
    color: #93c5fd !important;
    background: rgba(30, 41, 59, 0.6) !important;
}

/* Hover */
#statsZoneContainer tbody tr:hover,
#statsTable tbody tr:hover {
    background: rgba(59, 130, 246, 0.05) !important;
}

/* Dernière ligne */
#statsZoneContainer tbody tr:last-child td,
#statsTable tbody tr:last-child td {
    border-bottom: none !important;
}

/* Classes pour le contenu des cellules */
.stats-year {
    font-weight: 600 !important;
    color: #93c5fd !important;
}

.stats-price-main {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    font-family: 'JetBrains Mono', monospace !important;
    color: #93c5fd !important;
    display: block !important;
}

.stats-price-m2 {
    font-size: 0.875rem !important;
    color: #c4b5fd !important;
    display: block !important;
    margin-top: 0.25rem !important;
}

.stat-prix-total {
    font-size: 20px;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 4px;
}

.stat-prix-m2 {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.stat-details {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.stats-details {
    font-size: 0.75rem !important;
    color: #64748b !important;
    margin-top: 0.5rem !important;
    line-height: 1.5 !important;
}

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

@media (max-width: 1200px) {
    .stats-grid,
    #statsGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .stats-grid,
    #statsGrid {
        grid-template-columns: 1fr !important;
    }
    
    #statsZoneContainer table,
    #statsTable {
        font-size: 0.85rem;
    }
    
    #statsZoneContainer thead th,
    #statsZoneContainer tbody td,
    #statsTable thead th,
    #statsTable tbody td {
        padding: 0.75rem 0.5rem !important;
    }
}

/* ========================================
   BOUTON EXPORT CSV
   ======================================== */
.export-excel-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    margin-bottom: 1.5rem;
}

.export-excel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

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

.export-excel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.export-excel-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.export-excel-btn .loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   LÉGENDE STATISTIQUES
   ======================================== */
.stats-legend {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.6;
}

.stats-legend strong {
    color: #3b82f6;
    display: block;
    margin-bottom: 0.5rem;
}

/* ========================================
   SECTION RPLS - LOGEMENT SOCIAL
   Style sombre cohérent avec stats-table
   ======================================== */

.section-rpls {
    background: rgba(30, 41, 59, 0.8);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.section-rpls h3 {
    color: #f1f5f9;
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(139, 92, 246, 0.6);
}

/* ===== 2 CARTES HORIZONTALES RPLS ===== */
.rpls-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.rpls-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(124, 58, 237, 0.15) 100%);
    border: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

.rpls-card-icon {
    font-size: 48px;
    line-height: 1;
}

.rpls-card-content {
    flex: 1;
}

.rpls-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #c4b5fd;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
}

.rpls-card-label {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.rpls-card-detail {
    color: #64748b;
    font-size: 12px;
    margin-top: 6px;
}

/* Carte Taux SRU - OK (vert) */
.rpls-card.taux-ok {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.15) 100%);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

.rpls-card.taux-ok .rpls-card-value {
    color: #6ee7b7;
}

/* Carte Taux SRU - Déficit (orange) */
.rpls-card.taux-deficit {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.rpls-card.taux-deficit .rpls-card-value {
    color: #fcd34d;
}

/* ===== GRAPHIQUE RPLS ===== */
.rpls-chart-wrapper {
    background: rgba(15, 23, 42, 0.6);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

#rplsChart {
    max-width: 400px;
    margin: 0 auto;
}

/* ===== TITRE DU TABLEAU RPLS ===== */
.rpls-table-title {
    color: #e2e8f0;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

/* ===== TABLEAU RPLS - STYLE STATS-TABLE ===== */
.rpls-table-container {
    overflow-x: auto;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.rpls-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    min-width: 500px;
}

/* En-tête violet */
.rpls-table thead {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.rpls-table th {
    color: #ffffff;
    font-weight: 600;
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.9rem;
    border: none;
    background: transparent;
}

.rpls-table th.text-right {
    text-align: right;
}

/* Corps du tableau */
.rpls-table tbody {
    background: rgba(15, 23, 42, 0.4);
}

.rpls-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    vertical-align: middle;
    background: transparent;
}

.rpls-table td.text-right {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

/* Lignes de détail RPLS */
.rpls-row-item td {
    background: transparent;
    padding-left: 1.5rem;
    color: #cbd5e1;
}

.rpls-row-item:hover td {
    background: rgba(139, 92, 246, 0.1);
}

/* Pastille de couleur RPLS */
.rpls-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
    box-shadow: 0 0 8px currentColor;
}

/* Code de financement RPLS */
.rpls-code {
    color: #64748b;
    font-size: 11px;
    margin-left: 6px;
}

/* ===== LIGNES DE SOUS-TOTAL RPLS - MISE EN AVANT ===== */
.rpls-row-subtotal td {
    background: rgba(139, 92, 246, 0.18);
    padding: 1rem 1.25rem;
    border-bottom: 2px solid rgba(139, 92, 246, 0.4);
    color: #f1f5f9;
}

.rpls-row-subtotal td:first-child {
    position: relative;
    padding-left: 1.5rem;
}

.rpls-subtotal-marker {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 2px 2px 0;
}

.rpls-row-subtotal strong {
    color: #c4b5fd;
    font-size: 0.95rem;
}

.rpls-row-subtotal td.text-right {
    color: #c4b5fd;
    font-weight: 600;
}

.rpls-group-desc {
    font-size: 11px;
    color: #94a3b8;
    font-weight: normal;
    margin-top: 3px;
}

/* ===== LIGNE TOTAL RPLS ===== */
.rpls-row-total td {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #ffffff;
    font-size: 1rem;
    padding: 1rem 1.25rem;
    border: none;
}

.rpls-row-total td strong {
    color: #ffffff;
}

/* ===== SOURCE RPLS ===== */
.rpls-source {
    margin-top: 16px;
    text-align: right;
    color: #94a3b8;
    font-size: 12px;
}

/* ===== RESPONSIVE RPLS ===== */
@media (max-width: 768px) {
    .rpls-cards-row {
        grid-template-columns: 1fr;
    }

    .rpls-card {
        padding: 20px;
    }

    .rpls-card-value {
        font-size: 1.5rem;
    }

    .rpls-card-icon {
        font-size: 36px;
    }

    .rpls-table {
        font-size: 13px;
        min-width: 400px;
    }

    .rpls-table th,
    .rpls-table td {
        padding: 0.75rem 1rem;
    }

    .rpls-row-item td {
        padding-left: 1rem;
    }
}

/* ===== INFOBULLES RPLS ===== */
.rpls-label-with-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rpls-tooltip-icon {
    font-size: 12px;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.rpls-tooltip-icon:hover {
    opacity: 1;
}

.rpls-tooltip {
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 8px;
    width: 320px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.rpls-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.98);
}

.rpls-label-with-tooltip:hover .rpls-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Position alternative si proche du haut */
.rpls-row-item:first-child .rpls-tooltip {
    bottom: auto;
    top: 100%;
    margin-top: 8px;
    margin-bottom: 0;
}

.rpls-row-item:first-child .rpls-tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(15, 23, 42, 0.98);
}