:root {
    --text-primary: #111111;
    --text-secondary: #555555;
    --card-bg: #FFFFFF;
    --toggle-bg: #304a5e;
    --app-bg: #4a7a94;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: #3b5f76;
    display: flex;
    justify-content: center;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(180deg, #2c4c61 0%, #4a7a94 100%);
}

.app-container {
    width: 100%;
    max-width: 420px;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Search Bar */
.search-container {
    background: #FFFFFF;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    /* For dropdown */
}

.search-icon {
    color: #666;
    width: 18px;
    height: 18px;
}

.search-input {
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: #333;
    width: 100%;
    font-family: var(--font-family);
}

.search-input::placeholder {
    color: #757575;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow: hidden;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 1px solid #eee;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f5f5f5;
}

/* Toggle Control */
.toggle-container {
    background: var(--toggle-bg);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-option {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-weight: 500;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toggle-option.active {
    background: #FFFFFF;
    color: #000;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Cards Container */
#cards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Weather Card */
.weather-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-badge svg {
    width: 14px;
    height: 14px;
    color: #000;
}

.location-badge h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
}

/* Horizontal Forecast List */
.forecast-container {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 -20px;
    padding: 0 20px;

    /* Enable Scroll Snap */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.forecast-container::-webkit-scrollbar {
    display: none;
}

.forecast-list {
    display: flex;
    justify-content: flex-start;
    /* Allow items to flow naturally */
    gap: 18px;
    /* Consistent gap */
    min-width: 100%;
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 52px;
    /* Slightly wider for ease of use */
    text-align: center;

    /* Snap alignment */
    scroll-snap-align: start;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.forecast-day {
    font-size: 0.9rem;
    color: #000;
    font-weight: 500;
    white-space: nowrap;
}

.forecast-icon-container {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forecast-icon-container svg {
    width: 32px;
    height: 32px;
}

.forecast-temps-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 500;
    min-height: 48px;
    justify-content: center;
}

.temp-high {
    font-size: 1.1rem;
    font-weight: 500;
    color: #000;
}

.temp-low {
    font-size: 1rem;
    color: #000;
    font-weight: 400;
}

.temp-single {
    font-size: 1.1rem;
    font-weight: 500;
    color: #000;
}

/* Card Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
}

.view-full {
    color: #1a73e8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-arrows {
    display: flex;
    gap: 16px;
}

.nav-arrow {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    color: #666;
}

.nav-arrow.next {
    color: #1a73e8;
}

/* Full Forecast Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.overlay.visible {
    transform: translateX(0);
}

.overlay.hidden {
    display: none;
    /* Just to fully hide from screen readers/focus when animating out */
}

.overlay-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
}

.back-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
    color: #333;
}

.overlay-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.overlay-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Date Strip */
.date-strip {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.date-strip::-webkit-scrollbar {
    display: none;
}

.date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    min-width: 70px;
    cursor: pointer;
    color: #666;
}

.date-item.active {
    background: #f0f7ff;
    color: #1a73e8;
    font-weight: 600;
}

.date-item svg {
    width: 24px;
    height: 24px;
    margin: 8px 0;
}

/* Day Summary */
.summary-text {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.summary-condition {
    display: block;
    color: #555;
    margin-bottom: 4px;
}

.summary-temps {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
}

.summary-temps .temp-night {
    font-size: 1.1rem;
    font-weight: 400;
    color: #666;
}

/* Tabs */
.tabs-container {
    display: flex;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    border-right: 1px solid #e0e0e0;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn.active {
    background: #2c5871;
    /* Matching the darker blue from screenshot */
    color: #fff;
}

/* Hourly Details Grid */
.hourly-details-grid {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 12px;
}

.detail-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 48px;
}

.detail-val {
    font-weight: 600;
    color: #333;
}

.detail-time {
    font-size: 0.85rem;
    color: #666;
    margin-top: 8px;
}

/* Wind Section */
.wind-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.wind-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin-bottom: 16px;
}

.wind-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.wind-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wind-dir-arrow {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.wind-warning {
    background: #ffa000;
    color: #000;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

/* Radar Map Section */
#radar-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #222;
    /* Dark background for the whole unit */
}

#map {
    width: 100%;
    height: 350px;
    background: #f0f0f0;
    z-index: 1;
}

/* Legend Overlay */
.map-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 500;
    /* Above map */
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-title {
    color: #ccc;
    font-size: 0.7rem;
    font-weight: 500;
}

.legend-bar {
    width: 200px;
    height: 8px;
    background: linear-gradient(to right,
            #87CEFA,
            /* Light Blue */
            #4169E1,
            /* Royal Blue */
            #32CD32,
            /* Lime Green */
            #FFD700,
            /* Gold */
            #FFA500,
            /* Orange */
            #FF4500,
            /* Orange Red */
            #8B0000
            /* Dark Red */
        );
    border-radius: 4px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    width: 200px;
}

.legend-labels span {
    color: #fff;
    font-size: 0.65rem;
}

/* Dark Controls Bar */
.radar-controls {
    background: #222;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
}

#radar-play-btn {
    background: none;
    color: #ADFF2F;
    /* Greenish play button */
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#radar-play-btn:hover {
    transform: scale(1.1);
}

#radar-play-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Timeline */
.timeline-container {
    flex: 1;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.timeline-metadata {
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    font-size: 0.9rem;
    color: #ADFF2F;
    font-weight: 600;
}

.timeline-track {
    width: 100%;
    height: 4px;
    background: #444;
    border-radius: 2px;
    position: relative;
}

.timeline-progress {
    height: 100%;
    background: #ADFF2F;
    width: 0%;
    /* Dynamic */
    border-radius: 2px;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 0.3s linear;
}

.timeline-ticks {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    height: 20px;
    pointer-events: none;
}

.timeline-tick {
    position: absolute;
    width: 1px;
    height: 6px;
    background: #666;
    bottom: 0;
}

.timeline-tick.major {
    height: 10px;
    background: #999;
}

.timeline-label {
    position: absolute;
    bottom: -20px;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #aaa;
    white-space: nowrap;
}

/* Hide old slider elements if they exist in DOM for safety */
#radar-time-slider,
#radar-time-label {
    display: none !important;
}