:root {    
    --sky-clear-top: #e6f7ff;
    --sky-clear-bottom: #a8d0f0;
    --sky-cloudy-top: #cacaca;
    --sky-cloudy-bottom: #70a0c7;
    --sky-rainy-top: #7a7f8d;
    --sky-rainy-bottom: #cacaca;
    --sky-storm-top: #c9d6e2;
    --sky-storm-bottom: #7b8a9a;
    --sky-snow-top: #f0f5fb;
    --sky-snow-bottom: #d8dfe6;
}

body.dark-mode {
    --sky-clear-top: #0a1020;
    --sky-clear-bottom: #441a45;
    --sky-cloudy-top: #262729;
    --sky-cloudy-bottom: #142236;
    --sky-rainy-top: #2a3040;
    --sky-rainy-bottom: #262729;
    --sky-storm-top: #080e18;
    --sky-storm-bottom: #292b2e;
    --sky-snow-top: #3e3e3b;
    --sky-snow-bottom: #706e6b;
}


/* Sat Weather Switch Elements */

.weather-switch-container {
    display: flex;
    justify-content: flex-start;
    margin: 20px 0;
}

.weather-switch {
    display: flex;
    background-color: var(--button-bg);
    border-radius: var(--button-radius);
    padding: 4px;
    gap: 4px;
    position: relative;
    width: 420px;
}

.weather-switch button {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: calc(var(--button-radius) - 4px);
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 16pt;
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.weather-switch button.active {
    color: var(--button-text);
}

.weather-switch::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    width: calc((100% - 8px) / 3);
    background-color: var(--weather-switch-slider);
    border-radius: calc(var(--button-radius) - 4px);
    transform: translateX(calc(var(--slider-position) * 100%));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.weather-image {
    width: 100%;
    max-width: 1250px;
    opacity: 0;
    display: none;
    border-radius: var(--button-radius);
    transition: opacity 0.3s ease;
}

.weather-image.active {
    display: block;
    opacity: 1;
}


/* Weather Forecast */

.forecast-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 15px;
    margin: 18px 0;
    max-width: 1100px;
}

.forecast-day {
    border-radius: var(--button-radius);
    padding: 15px;
    text-align: center;
    position: relative;
    min-width: 120px;
    max-width: 180px;
}

.hourly-avail {
    /* box-shadow: 5px 5px 9px 0px rgba(0, 0, 0, 0.5); */
    /* border-color: var(--tesla-blue); */
    /* border-width: 2pt; */
    /* border-style: solid; */
    cursor: pointer;
}

#minutely-precip-container {
    max-width: 1100px;
}

#minutely-precip-chart {
    display: flex;
    justify-content: center;
    max-height: 320px;
    margin-left: 11pt;
    margin-right: 11pt;
}


/* Weather condition-specific gradients */

.forecast-day.clear {
    background: linear-gradient(to bottom, var(--sky-clear-top), var(--sky-clear-bottom));
}

.forecast-day.clouds {
    background: linear-gradient(to bottom, var(--sky-cloudy-top), var(--sky-cloudy-bottom));
}

.forecast-day.rain {
    background: linear-gradient(to bottom, var(--sky-rainy-top), var(--sky-rainy-bottom));
}

.forecast-day.storm, .forecast-day.thunderstorm {
    background: linear-gradient(to bottom, var(--sky-storm-top), var(--sky-storm-bottom));
}

.forecast-day.snow {
    background: linear-gradient(to bottom, var(--sky-snow-top), var(--sky-snow-bottom));
}

/* Invert snow icon in dark mode */
body.dark-mode .forecast-day.snow img.forecast-icon {
    filter: invert(1);
}

/* Invert clear icon in dark mode and make it grayscale */
body.dark-mode .forecast-day.clear img.forecast-icon {
    filter: invert(1);
    filter: grayscale(1);
}

/* Invert rain icon in dark mode and make it grayscale */
body.dark-mode .forecast-day.rain img.forecast-icon {
    filter: invert(1);
    filter: grayscale(1);
}

.forecast-alert {
    position: absolute;
    top: 5px;
    left: 7px;
}

.forecast-date {
    font-size: 13pt;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 12pt;
    font-weight: 650;
    text-transform: uppercase;
    color: var(--button-text);
}

/* .hourly-avail .forecast-date {
    color: var(--tesla-blue);
} */

.forecast-icon {
    width: 64px;
    height: 64px;
    margin: 9px;
}

.forecast-temp {
    font-size: 15pt;
    font-weight: 750;
    margin: 8px 0;
    color: var(--button-text);
}

.forecast-desc {
    font-family: "Inter", sans-serif;
    font-size: 14pt;
    font-style: italic;
    font-weight: 600;
    color: var(--button-text);
}

.forecast-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--active-section-bg);
    border-radius: var(--button-radius);
    padding: 20px;
    z-index: 1000;
    max-width: 90%;
    width: 90%; /* Increased width to fit more items */
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
}

.forecast-popup.show {
    display: block;
}

.forecast-popup-close {
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgb(205 205 205 / 50%);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    /* font-family: monospace; */
    padding-bottom: 4px;
    padding-left: 7px;
    color: var(--button-text);
    transition: all 0.2s ease;
}

.forecast-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
}

.hourly-forecast {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    margin-top: 15px;
    max-width: 1140px; /* 90px × 12 + 6px × 11 gaps = 1146px, rounded down slightly */
    margin-left: auto;
    margin-right: auto;
}

.hourly-item {
    background: linear-gradient(to bottom, var(--sky-gradient-top), var(--sky-gradient-bottom));
    padding: 6px;
    border-radius: var(--button-radius);
    text-align: center;
    transition: background 0.3s ease;
}

/* Weather condition-specific gradients for hourly items */
.hourly-item.clear {
    background: linear-gradient(to bottom, var(--sky-clear-top), var(--sky-clear-bottom));
}

.hourly-item.clouds {
    background: linear-gradient(to bottom, var(--sky-cloudy-top), var(--sky-cloudy-bottom));
}

.hourly-item.rain {
    background: linear-gradient(to bottom, var(--sky-rainy-top), var(--sky-rainy-bottom));
}

.hourly-item.storm, .hourly-item.thunderstorm {
    background: linear-gradient(to bottom, var(--sky-storm-top), var(--sky-storm-bottom));
}

.hourly-item.snow {
    background: linear-gradient(to bottom, var(--sky-snow-top), var(--sky-snow-bottom));
}

.hourly-time {
    font-weight: 500;
    font-size: 11pt; /* Reduced font size */
    color: var(--button-text);
    margin-bottom: 2px; /* Reduced margin */
}

.hourly-icon {
    width: 32px; /* Smaller icon */
    height: 32px; /* Smaller icon */
}

.hourly-temp {
    color: var(--button-text);
    font-size: 11pt; /* Reduced font size */
    font-weight: 750;
    margin: 2px 0; /* Reduced margin */
}

.hourly-desc {
    color: var(--button-text);
    font-size: 10pt; /* Reduced font size */
    font-style: italic;
    font-weight: 600;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide text that doesn't fit */
    text-overflow: ellipsis; /* Add ellipsis for overflow text */
}

.station-name {
    font-size: 11pt;
    text-transform: uppercase;
    margin-left: 10px;
    color: var(--text-color);
}

/* Moon phase icon */
.moon-phase-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    vertical-align: baseline;
    background-color: #ccc;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

/* Dark mode styles for moon icon */
body.dark-mode .moon-phase-icon {
    background-color: #555;
}

/* Mobile Landscape Mode */
@media only screen and (max-width: 900px) and (orientation: landscape) {
    /* Weather switch elements */
    .weather-switch-container {
        margin: 10px 0;
    }
    
    .weather-switch {
        width: 320px;
    }
    
    .weather-switch button {
        padding: 10px 16px;
        font-size: 14pt;
    }
    
    /* Weather images */
    .weather-image {
        max-width: 95%;
    }
    
    /* Forecast container */
    .forecast-container {
        gap: 10px;
        margin: 12px 0;
        max-width: 95%;
    }
    
    .forecast-day {
        padding: 10px;
        min-width: 100px;
        max-width: 140px;
    }
    
    .forecast-date {
        font-size: 10pt;
        margin-bottom: 5px;
    }
    
    .forecast-icon {
        width: 48px;
        height: 48px;
        margin: 5px;
    }
    
    .forecast-temp {
        font-size: 13pt;
        margin: 5px 0;
    }
    
    .forecast-desc {
        font-size: 12pt;
    }
    
    /* Forecast popup */
    .forecast-popup {
        width: 90%;
        max-height: 70vh;
    }
    
    .hourly-forecast {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); /* Even smaller for landscape */
        gap: 5px;
    }
    
    .hourly-item {
        padding: 5px;
    }
    
    .hourly-time {
        font-size: 10pt;
    }
    
    .hourly-icon {
        width: 28px;
        height: 28px;
    }
    
    .hourly-temp {
        font-size: 10pt;
        margin: 1px 0;
    }
    
    .hourly-desc {
        font-size: 9pt;
    }
    
    /* Moon phase icon */
    .moon-phase-icon {
        width: 14px;
        height: 14px;
    }
}

/* Notification styles - with dark mode support */
.notification {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Light mode defaults */
    background-color: rgba(255, 255, 255, 0.85);
    color: #cc6600; /* Darker orange for light mode */
}

body.dark-mode .notification {
    background-color: rgba(33, 33, 33, 0.9);
    color: #ff7700; /* Brighter orange for dark mode */
}

.notification.show {
    opacity: 0.95;
}

.notification.hide {
    opacity: 0;
}

.notification-message {
    font-size: 18px;
    font-weight: 700;
}

/* Cloud icon styles for both status indicator and notification */
.rain-status img,
.notification-icon img {
    filter: invert(50%) sepia(68%) saturate(3233%) hue-rotate(360deg) brightness(103%) contrast(103%);
}

body.dark-mode .rain-status img,
body.dark-mode .notification-icon img {
    filter: invert(74%) sepia(69%) saturate(5422%) hue-rotate(359deg) brightness(101%) contrast(107%);
}

/* Add a little spacing between the notification icon and text */
.notification-icon {
    margin-right: 12px;
}
