/* ============================================================
   Page-Specific Styles
   ============================================================ */

/* --- Login Page --- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79,109,255,0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: pulse-glow 8s ease-in-out infinite alternate;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(52,211,153,0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation: pulse-glow 6s ease-in-out 2s infinite alternate;
}

@keyframes pulse-glow {
    from { opacity: 0.5; transform: scale(1); }
    to { opacity: 1; transform: scale(1.15); }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(26,29,46,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-9);
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .login-card {
    background: rgba(255,255,255,0.9);
}

[data-theme="light"] .login-screen {
    background: linear-gradient(135deg, #e8ecf4 0%, #d5dce8 50%, #c7d0e0 100%);
}

[data-theme="light"] .login-screen::before {
    background: radial-gradient(circle, rgba(59,86,204,0.12) 0%, transparent 70%);
}

[data-theme="light"] .login-screen::after {
    background: radial-gradient(circle, rgba(22,163,74,0.08) 0%, transparent 70%);
}

.login-card .login-logo {
    display: block;
    margin: 0 auto var(--space-6);
    height: 52px;
}

.login-card h1 {
    text-align: center;
    font-size: var(--text-xl);
    margin-bottom: var(--space-1);
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-7);
}

.login-card .login-footer {
    text-align: center;
    color: var(--text-dimmed);
    font-size: var(--text-xs);
    margin-top: var(--space-6);
}

/* --- Dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (max-width: 991px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.chart-container {
    position: relative;
    height: 280px;
}

.famille-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
}

.famille-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease);
    border-left: 4px solid var(--famille-color, var(--primary));
}

.famille-card:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.axes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-3);
}

.axe-card {
    background: var(--primary-muted);
    border: 1px solid rgba(79,109,255,0.1);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

/* --- Map --- */
.map-wrapper {
    position: relative;
    height: calc(100vh - var(--header-height) - 140px);
    min-height: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-wrapper #map {
    width: 100%;
    height: 100%;
}

.map-filters-panel {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 1000;
    width: 280px;
    background: rgba(26,29,46,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    max-height: calc(100% - var(--space-6));
    overflow-y: auto;
}

.map-filters-panel h4 {
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.map-filters-panel input[type="search"] {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}

.map-filters-panel input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
}

.map-famille-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 0;
}

.map-famille-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.map-options-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 0;
}

/* Leaflet overrides for dark mode */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

.leaflet-popup-content {
    font-size: var(--text-sm) !important;
    line-height: 1.5 !important;
}

.leaflet-popup-content a {
    color: var(--primary) !important;
}

/* Cluster overrides */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(79,109,255,0.3) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: var(--fw-bold) !important;
    font-size: var(--text-xs) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-elevated) !important;
}

.leaflet-control-attribution {
    background: rgba(15,17,23,0.7) !important;
    color: var(--text-dimmed) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--text-muted) !important;
}

/* --- Graph --- */
.graphe-wrapper {
    position: relative;
    height: calc(100vh - var(--header-height) - 200px);
    min-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.graphe-wrapper svg {
    width: 100%;
    height: 100%;
}

.graphe-controls {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    z-index: 10;
}

.graphe-controls button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26,29,46,0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: var(--text-lg);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease);
}

.graphe-controls button:hover { background: var(--bg-elevated); }

.graphe-tooltip {
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    box-shadow: var(--shadow);
    pointer-events: none;
    z-index: 100;
    max-width: 300px;
}

.graphe-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    font-size: var(--text-xs);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: var(--space-3);
}

.graphe-legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.graphe-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.graphe-legend-line {
    width: 20px;
    height: 2px;
    flex-shrink: 0;
}

/* --- Fiche Acteur --- */
.fiche-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--space-5);
}

@media (max-width: 1100px) {
    .fiche-layout { grid-template-columns: 1fr; }
}

.fiche-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
}

.fiche-sidebar .mini-map-container {
    height: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* --- Import / Export --- */
.import-export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 767px) {
    .import-export-grid { grid-template-columns: 1fr; }
}

.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-8);
    text-align: center;
    transition: all var(--duration-fast) var(--ease);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-muted);
}

.drop-zone .drop-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-2);
    opacity: 0.6;
}

/* --- Recherche --- */
.search-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: var(--space-4);
}

@media (max-width: 991px) {
    .search-layout { grid-template-columns: 1fr; }
}

.search-criteria {
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease);
    border-left: 4px solid var(--result-color, var(--primary));
    margin-bottom: var(--space-3);
}

.result-card:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

/* --- Light mode overrides for Leaflet popups --- */
[data-theme="light"] .leaflet-popup-content-wrapper {
    background: #fff !important;
    color: #1a1d2e !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .leaflet-popup-tip { background: #fff !important; }

[data-theme="light"] .leaflet-control-zoom a {
    background: #fff !important;
    color: #1a1d2e !important;
    border-color: rgba(0,0,0,0.15) !important;
}
[data-theme="light"] .leaflet-control-attribution {
    background: rgba(255,255,255,0.8) !important;
    color: #6b7085 !important;
}

/* --- Light mode overrides for map filter panel --- */
[data-theme="light"] .map-filters-panel {
    background: rgba(255,255,255,0.95);
}

/* --- Light mode overrides for graphe --- */
[data-theme="light"] .graphe-controls button {
    background: rgba(255,255,255,0.92);
}
[data-theme="light"] .graphe-tooltip {
    background: #fff;
    border-color: rgba(0,0,0,0.1);
}

/* --- Theme toggle button --- */
#theme-toggle {
    font-size: 1.2rem;
    transition: transform var(--duration-fast) var(--ease);
}
#theme-toggle:hover {
    transform: rotate(30deg);
}
