/* ============================================================
   WEATHER DASHBOARD — Dark Observatory Theme
   ============================================================ */

:root {
    --bg-deep: #0B0D17;
    --bg-surface: #121829;
    --bg-surface-hover: #1A2240;
    --bg-elevated: #1E2642;
    --accent-primary: #3B82F6;
    --accent-secondary: #06B6D4;
    --accent-warm: #F59E0B;
    --accent-success: #10B981;
    --accent-danger: #EF4444;
    --accent-purple: #7C3AED;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #475569;
    --border-subtle: #1E293B;
    --border-glass: rgba(255, 255, 255, 0.08);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 300ms;
    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    cursor: default;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Permettre la sélection uniquement dans les champs de saisie */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    cursor: text;
}

/* === NAVBAR === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-xl);
    background: rgba(11, 13, 23, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.brand-icon { display: block; }

.brand-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.nav-search {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto;
}

.search-wrapper { position: relative; width: 100%; }

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrapper input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: all var(--duration) var(--ease);
}

.search-wrapper input::placeholder { color: var(--text-muted); }

.search-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.nav-btn, .nav-btn-label {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.nav-btn {
    width: 38px;
    height: 38px;
}

.nav-btn-label {
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--duration) var(--ease);
}

.nav-btn:hover, .nav-btn-label:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Dropdown */
.dropdown-wrapper { position: relative; }

.dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 200;
}

.dropdown-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.dropdown-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.dropdown-input:focus { border-color: var(--accent-primary); }

.btn-primary-sm {
    padding: 8px 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--duration) var(--ease);
}

.btn-primary-sm:hover { background: #2563EB; }

.dropdown-action {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all var(--duration) var(--ease);
}

.dropdown-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Autocomplete */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow-card);
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    transition: all 150ms var(--ease);
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.autocomplete-loading {
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* === HERO (Globe) === */
.hero-section {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 400px;
    max-height: 750px;
    margin-top: 60px;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 50%, #0f1a3a 0%, var(--bg-deep) 70%);
}

.globe-container { width: 100%; height: 100%; }

.hero-overlay {
    position: absolute;
    bottom: var(--space-xl);
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

.hero-hint {
    font-size: 14px;
    color: var(--text-muted);
    background: rgba(11, 13, 23, 0.6);
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
}

.location-badge {
    position: absolute;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    background: rgba(18, 24, 41, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
}

.badge-city {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.badge-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.badge-sep { color: var(--border-subtle); }

/* Globe fallback */
.globe-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fallback-visual {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #1a3a6a 0%, #0B0D17 70%);
    box-shadow: 0 0 80px rgba(59, 130, 246, 0.25), inset 0 0 40px rgba(59, 130, 246, 0.1);
    animation: gentle-pulse 4s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { box-shadow: 0 0 80px rgba(59, 130, 246, 0.25), inset 0 0 40px rgba(59, 130, 246, 0.1); }
    50% { box-shadow: 0 0 100px rgba(59, 130, 246, 0.35), inset 0 0 60px rgba(59, 130, 246, 0.15); }
}

/* === LOADING & ERROR === */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text { font-size: 14px; color: var(--text-muted); }

.error-toast {
    position: fixed;
    top: 80px;
    left: var(--space-lg);
    z-index: 500;
    max-width: 260px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-danger);
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
    animation: toastSlideIn 0.3s var(--ease);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === RESULTS === */
.results-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl) var(--space-2xl);
    animation: fadeUp 0.5s var(--ease);
}

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

/* === CARDS === */
.data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.card {
    background: rgba(18, 24, 41, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-wide { margin-bottom: var(--space-lg); }

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-glass);
}

.card-icon { color: var(--accent-secondary); flex-shrink: 0; }

.card-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.card-body { padding: var(--space-lg); }

/* === WEATHER CARD === */
.temp-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.weather-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-icon-container svg {
    width: 64px;
    height: 64px;
}

.forecast-day-icon svg {
    width: 32px;
    height: 32px;
}

.temp-value {
    font-family: var(--font-mono);
    font-size: 52px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.conditions-text {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.weather-details { display: flex; flex-direction: column; }

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-subtle);
}

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

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

.detail-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* === UV === */
.uv-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.big-value {
    font-family: var(--font-mono);
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    display: block;
    text-align: center;
    margin-bottom: var(--space-sm);
}

.uv-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #10B981 0%, #10B981 18%, #F59E0B 18%, #F59E0B 45%, #F97316 45%, #F97316 64%, #EF4444 64%, #EF4444 91%, #7C3AED 91%, #7C3AED 100%);
    position: relative;
}

.uv-bar-indicator {
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: left 0.6s var(--ease);
    left: 0%;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.status-badge.badge-low { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.status-badge.badge-moderate { background: rgba(245, 158, 11, 0.15); color: var(--accent-warm); }
.status-badge.badge-high { background: rgba(249, 115, 22, 0.15); color: #F97316; }
.status-badge.badge-very-high { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }
.status-badge.badge-extreme { background: rgba(124, 58, 237, 0.15); color: var(--accent-purple); }
.status-badge.badge-good { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.status-badge.badge-unhealthy { background: rgba(249, 115, 22, 0.15); color: #F97316; }
.status-badge.badge-hazardous { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }
.status-badge.badge-unknown { background: rgba(71, 85, 105, 0.15); color: var(--text-muted); }

/* === RECOMMENDATIONS === */
.recommendations-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.recommendations-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-left: 3px solid var(--accent-secondary);
}

/* === FORECAST === */
.forecast-chart-container {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: rgba(11, 13, 23, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.forecast-days {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
}

.forecast-day {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    transition: all var(--duration) var(--ease);
}

.forecast-day:hover {
    border-color: var(--accent-primary);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
}

.forecast-day-date {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.forecast-day-icon { font-size: 32px; margin: var(--space-sm) 0; line-height: 1; }

.forecast-day-temps {
    font-family: var(--font-mono);
    font-size: 13px;
    margin-top: var(--space-sm);
}

.forecast-day-temp-max { color: var(--accent-warm); font-weight: 700; }
.forecast-day-temp-min { color: var(--accent-secondary); }

.forecast-day-condition {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* === FOOTER === */
.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-xl) var(--space-md);
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

.footer-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

.footer a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

.footer a:hover { color: var(--accent-primary); }

/* === UTILITY === */
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .data-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .navbar { padding: var(--space-sm) var(--space-md); gap: var(--space-sm); }
    .brand-text { display: none; }
    .nav-search { max-width: none; }
    .hero-section { height: 45vh; min-height: 300px; }
    .data-grid { grid-template-columns: 1fr; margin-top: -40px; }
    .results-section { padding: 0 var(--space-md) var(--space-xl); }
    .temp-value { font-size: 40px; }
    .big-value { font-size: 36px; }
    .forecast-days { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}

@media (max-width: 480px) {
    .nav-actions .dropdown-wrapper:last-child { display: none; }
    .hero-section { height: 35vh; min-height: 250px; }
    .location-badge { padding: 8px 16px; }
    .badge-city { font-size: 15px; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
