:root {
    --primary-color: #2c3e50;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --glass-bg: rgba(20, 20, 25, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    background-color: #111;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-main {
    flex: 1;
    display: flex;
    position: relative;
    height: 100%;
}

.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000dd;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-overlay h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.loading-overlay p {
    color: var(--text-muted);
}

/* Floating UI Panel */
.floating-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 350px;
    z-index: 1000;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.glass-panel, .glass-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

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

.panel-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.voice-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Mic pulsing animation */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.btn-danger.listening {
    animation: pulse 1.5s infinite;
}

#transcript-container {
    padding: 16px;
    border-radius: 12px;
}

#transcript-container h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

#transcript-text {
    font-style: italic;
    color: #e2e8f0;
    min-height: 20px;
    font-size: 15px;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chip.active {
    background: rgba(59, 130, 246, 0.4);
    border-color: #3b82f6;
    color: #fff;
}

/* Stats Section */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card {
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

/* Leaflet dark mode overrides */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaflet-popup-content b {
    color: var(--accent-color);
}

.popup-item {
    margin-bottom: 4px;
}

.popup-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 4px;
}

hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 8px 0;
}

.dynamic-data {
    font-size: 13px;
}

.loading-text {
    font-style: italic;
    color: var(--text-muted);
    animation: pulse 1.5s infinite;
}

/* Legend Styling */
.info.legend {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-color);
    border-radius: 12px;
    line-height: 24px;
}

.info.legend h4 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.info.legend i {
    width: 16px;
    height: 16px;
    float: left;
    margin-right: 8px;
    opacity: 0.8;
    margin-top: 4px;
    border-radius: 4px;
}

/* Time Slider */
.time-slider-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 800px;
    z-index: 1000;
    border-radius: 20px;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

#slider-year-display {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.glass-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.glass-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
    transition: transform 0.1s;
}

.glass-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Basemap Selector */
.basemap-selector {
    position: absolute;
    top: 20px;
    right: 65px;
    z-index: 1000;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.glass-select {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding: 8px 12px;
}

.glass-select option {
    background: rgba(30, 30, 35, 0.95);
    color: #fff;
    border: none;
}
