/* Global CSS variables & Reset */
:root {
    --bg-dark: #07080c;
    --card-bg: rgba(16, 18, 30, 0.55);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --text-primary: #ffffff;
    --text-secondary: #8b92b6;
    --success: #10b981;
    --warning: #f59e0b;
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Glows */
.glow-bg {
    position: fixed;
    top: -10%;
    left: 20%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
    animation: glow-move 20s infinite alternate;
}

@keyframes glow-move {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 5vh) scale(1.1); }
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* App Container */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header & Logo */
.app-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.logo span {
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
}

/* Search Bar */
.search-container {
    position: relative;
    width: 320px;
}
@media (max-width: 600px) {
    .header-main {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-container {
        width: 100%;
    }
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 14px;
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    background: rgba(255, 255, 255, 0.08);
}

.search-icon {
    color: var(--text-secondary);
    margin-right: 8px;
}

#search-input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    outline: none;
}
#search-input::placeholder {
    color: var(--text-secondary);
}

#geo-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
#geo-btn:hover {
    color: var(--accent);
}

/* Suggestions Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #10111a;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}
.suggestion-item:last-child {
    border-bottom: none;
}
.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

.hidden {
    display: none !important;
}

/* Favorites Bar */
.favorites-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    width: 100%;
    padding: 4px 0;
}

.favorite-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.favorite-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}
.favorite-chip span {
    white-space: nowrap;
}
.favorite-chip button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}
.favorite-chip button:hover {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.15);
}

/* Glassmorphism Cards */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    background-image: var(--gradient-card);
}

/* Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    animation: fadeIn 0.5s ease-out;
}

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

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

/* Current Weather Card */
.current-weather-card {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.city-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.location-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 30px;
    font-weight: 700;
}

.location-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

.fav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 6px;
    transition: transform 0.2s, background 0.2s;
}
.fav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.1);
}
.star-icon {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-linejoin: round;
    transition: stroke 0.3s, fill 0.3s;
}
.fav-active .star-icon {
    fill: #ffb703;
    stroke: #ffb703;
    filter: drop-shadow(0 0 6px rgba(255, 183, 3, 0.5));
}

.date-info {
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 12px;
    border-radius: 8px;
}

.weather-primary {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 28px;
}

.temp-display {
    font-family: 'Outfit', sans-serif;
    font-size: 76px;
    font-weight: 700;
    line-height: 1;
    position: relative;
    letter-spacing: -2px;
}
.temp-display .deg {
    font-size: 40px;
    vertical-align: super;
    position: absolute;
    top: 5px;
}

.symbol-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.symbol-display img {
    width: 68px;
    height: 68px;
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.15));
}

#weather-description {
    font-size: 16px;
    color: var(--text-primary);
    text-transform: capitalize;
    margin-top: 4px;
}

/* Details Grid */
.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-item .label {
    font-size: 12px;
    color: var(--text-secondary);
}
.detail-item .value {
    font-size: 16px;
    font-weight: 600;
}

/* Section headers (Title + controls) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 20px;
}

.zoom-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.zoom-btn:hover {
    color: var(--text-primary);
}
.zoom-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Radar Map Card */
.radar-card {
    display: flex;
    flex-direction: column;
}

/* Leaflet Map Container */
.leaflet-map-container {
    width: 100%;
    height: 420px;
    border-radius: 12px;
    overflow: hidden;
    background: #090a10;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
}

/* Override leaflet attribution styling */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.75) !important;
    color: rgba(255,255,255,0.45) !important;
    font-size: 10px !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
}

.leaflet-control-attribution a {
    color: rgba(100, 180, 255, 0.8) !important;
}

.leaflet-control-zoom {
    border: none !important;
    margin: 12px !important;
}

.leaflet-control-zoom a {
    background: rgba(17, 19, 28, 0.92) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--card-border) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 30px !important;
    font-size: 16px !important;
    transition: background 0.2s !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(100, 80, 255, 0.3) !important;
    color: white !important;
}

.radar-container {
    position: relative;
    width: 100%;
}

/* Map Timeline Control Bar */
.map-timeline-control {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 24px;
    background: rgba(17, 19, 28, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 90%;
    max-width: 460px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.map-control-btn {
    background: var(--accent-primary);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.map-control-btn:hover {
    transform: scale(1.1);
    background: var(--accent-hover);
}

.map-timeline-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: grab !important;
    transition: background 0.2s;
}

.map-timeline-slider:active {
    cursor: grabbing !important;
}

/* WebKit (Chrome, Safari, Brave, Edge) styling */
.map-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: grab !important;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: transform 0.15s, background 0.15s;
    border: none;
}

.map-timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: white;
}

.map-timeline-slider::-webkit-slider-thumb:active {
    cursor: grabbing !important;
    transform: scale(1.3);
}

/* Firefox styling */
.map-timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: grab !important;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: transform 0.15s, background 0.15s;
}

.map-timeline-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: white;
}

.map-timeline-slider::-moz-range-thumb:active {
    cursor: grabbing !important;
    transform: scale(1.3);
}

#map-time-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Map legend / info overlay */
.map-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-scale {
    display: flex;
    gap: 3px;
    align-items: center;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.radar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: 12px;
}

.control-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--accent-glow);
    transition: transform 0.2s, background 0.2s;
}
.control-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.timeline-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#radar-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    background: rgba(255, 255, 255, 0.08);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    background: var(--accent);
    height: 100%;
    width: 0%;
    transition: width 0.15s linear;
}

/* Meteogram Card */
.meteogram-card {
    grid-column: 1 / -1;
}

.meteogram-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px;
    margin-top: 14px;
    overflow-x: auto;
}

#meteogram-svg {
    width: 100%;
    height: auto;
    min-width: 600px;
    display: block;
}

/* Meteogram SVG Styling */
.chart-axis-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}
.chart-temp-path {
    fill: none;
    stroke: #ff9f1c;
    stroke-width: 3;
    stroke-linecap: round;
}
.chart-temp-gradient-stop-top {
    stop-color: #ff9f1c;
    stop-opacity: 0.35;
}
.chart-temp-gradient-stop-bottom {
    stop-color: #ff9f1c;
    stop-opacity: 0.0;
}
.chart-rain-bar {
    fill: #4cc9f0;
    opacity: 0.7;
    rx: 2;
}
.chart-label {
    fill: var(--text-secondary);
    font-size: 11px;
    font-family: inherit;
    text-anchor: middle;
}
.chart-label-value {
    fill: var(--text-primary);
    font-weight: 600;
    font-size: 11px;
}
.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
}

/* Hourly Forecast Card */
.hourly-forecast-card {
    grid-column: 1 / -1;
}

.hourly-scroll-container {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-top: 14px;
    scroll-snap-type: x mandatory;
}

.hourly-item {
    flex: 0 0 85px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    scroll-snap-align: start;
    transition: background 0.2s, transform 0.2s;
}
.hourly-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.08);
}

.hourly-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hourly-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.15));
}

.hourly-temp {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.hourly-wind {
    font-size: 11px;
    color: var(--text-secondary);
}

.hourly-rain {
    font-size: 10px;
    color: #4cc9f0;
    margin-top: 2px;
}

/* Weekly Forecast Card */
.weekly-forecast-card {
    grid-column: 1 / -1; /* Stretch to full width for symmetric desktop grid layout */
}

.weekly-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.weekly-row {
    display: grid;
    grid-template-columns: 120px 40px 1fr 100px;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
    transition: background 0.2s;
}
.weekly-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.weekly-day {
    font-size: 14px;
    font-weight: 500;
}

.weekly-icon {
    width: 28px;
    height: 28px;
}

.weekly-temp-range {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    font-size: 14px;
    font-weight: 600;
}
.min-temp {
    color: var(--text-secondary);
}
.max-temp {
    color: var(--text-primary);
}

.weekly-bar-container {
    background: rgba(255, 255, 255, 0.06);
    height: 6px;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.weekly-bar {
    background: linear-gradient(90deg, #4cc9f0, #e0aaff, #ff9f1c);
    height: 100%;
    border-radius: 3px;
    position: absolute;
}

/* Loading & Error Indicators */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.15);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin: 40px auto;
    max-width: 400px;
}

.error-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

#error-message {
    color: #fda4af;
    font-size: 14px;
}

/* Globally remove outlines from Leaflet VectorGrid SVG tiles */
.leaflet-tile path {
    stroke: none !important;
    stroke-width: 0 !important;
    stroke-opacity: 0 !important;
}

/* Radar Map Card Full Width on Desktop */
.radar-card {
    grid-column: 1 / -1;
}

/* Fullscreen Map Button */
.map-fullscreen-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1001;
    background: rgba(17, 19, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
}

.map-fullscreen-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

.map-fullscreen-btn svg {
    display: block;
}

/* Fullscreen Map Mode */
.radar-container.fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #090a10;
}

.radar-container.fullscreen-active .leaflet-map-container {
    height: 100vh !important;
    border-radius: 0;
    border: none;
}

.radar-container.fullscreen-active .map-timeline-control {
    bottom: 24px;
    width: 95%;
}

.radar-container.fullscreen-active .map-fullscreen-btn {
    top: 24px;
    right: 24px;
}

/* Precipitation Threshold Dropdown Control */
.map-threshold-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.map-threshold-container label {
    font-size: 12px;
    color: #8892b0;
    font-weight: 500;
}

.map-threshold-select {
    background: rgba(17, 19, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.map-threshold-select:focus {
    border-color: var(--accent-primary);
}

.map-threshold-select option {
    background: #11131c;
    color: white;
}

/* Standard theme for fallback Leaflet Map */
.leaflet-container {
    background: #f4f4f5 !important;
}


