:root {
    --font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --font-weight-black: 900;
}

body {
    background: #ffffff;
    /* background: linear-gradient(135deg, #FAFBFB, #ffffff); */
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    color: #000000;
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-extrabold);
    text-align: center;
    margin-bottom: 1rem;
}

h2 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-extrabold);
    text-align: center;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    text-align: center;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    margin-bottom: 0.5rem;
}

p {
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

#main-icon {
    width: 100px !important;
    margin-bottom: -15px;
    cursor: pointer;
}

#current-weather {
    text-align: center;
    margin-bottom: 50px;
}

#current-weather img {
    width: 30px;
    vertical-align: middle;
}

#ai-forecast {
    padding: 15px;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: #333333;
    max-width: 600px;
    margin: 10px auto;
    margin-top: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
}

#ai-forecast h3 {
    font-size: var(--font-size-lg);
    margin-bottom: -20px;
}

.weather-detail {
    display: inline-block;
    margin: 10px 15px;
    text-align: center;
    font-size: var(--font-size-sm);
}

.weather-detail img {
    width: 10px;
    display: block;
    margin: 0 auto 5px;
}

#moon-symbol img {
    width: 28px;
}

.chart-container {
    position: relative;
    margin: auto;
    width: 85%;
    max-width: 1200px;
}

canvas {
    margin-bottom: 50px;
    pointer-events: auto;
}

canvas.chart-container {
    filter: brightness(80%) contrast(160%);
}

#hourly-chart-controls button,
#daily-chart-controls button,
#minutely-forecast-chart button {
    padding: 8px 16px;
    margin: 0 10px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
}

#hourly-chart-controls button:hover,
#daily-chart-controls button:hover,
#minutely-forecast-chart button:hover {
    background-color: #e9ecef;
}

#daily-chart-controls {
    margin-top: 20px;
}

/* Hamburger Menu Styling */
#toggle-button {
    position: fixed;
    top: 15px;
    left: 1px;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    box-sizing: border-box;
}

#toggle-button img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block;
}

/* Settings Panel Styling */
#settings-panel {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: #ffffff;
    border-right: 1px solid rgb(206, 206, 206);
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 20px;
    font-family: var(--font-family);
}

#settings-panel.active {
    left: 0;
}

/* Styles for the Locations Section */
#locations-section,
#options {
    margin-top: 20px;
}

#locations-section h3 {
    margin-bottom: 10px;
}

#current-location,
#add-location {
    margin-bottom: 15px;
}

#add-location input {
    width: calc(100% - 30px);
    padding: 8px;
    margin-right: 5px;
    font-size: var(--font-size-base);
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

#add-location button {
    margin-top: 10px;
    padding: 8px 16px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

#add-location button:hover {
    background-color: #e9ecef;
}

#add-location-status {
    margin-top: 5px;
    color: #ff0000;
    font-size: var(--font-size-sm);
}

#locations-list {
    list-style-type: none;
    padding-left: 0;
}

#locations-list li {
    margin-bottom: 15px;
    list-style: none;
    padding: 0;
}

.location-card,
#current-location {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.location-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.location-details {
    pointer-events: none;
}

.location-card strong {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
}

.location-card p {
    margin: 5px 0 0;
    color: #666;
    font-size: var(--font-size-sm);
}

.delete-location {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: transparent;
    border: none;
    color: #888;
    font-size: var(--font-size-sm);
    cursor: pointer;
    z-index: 1;
}

.delete-location:hover {
    color: #ff0000;
}

#current-location {
    cursor: pointer;
}

#current-location:hover {
    background-color: #f0f0f0;
}

footer {
    margin-top: 100px;
    text-align: center;
    font-size: var(--font-size-sm);
    color: #666;
}

#refresh-button {
    position: fixed;
    top: 15px;
    right: 15px;
    font-size: 35px;
    cursor: pointer;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

input[type="checkbox"] {
    margin-top: 5px;
}

/* Option cards styling */
.option-card {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    position: relative;
    margin-bottom: 15px;
    transition: box-shadow 0.2s ease;
    box-sizing: border-box;
    max-width: 100%;
}

.option-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option-content {
    display: flex;
    align-items: center;
}

.option-content input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.option-content label {
    cursor: pointer;
    font-size: var(--font-size-base);
}

/* First option needs special styling for the time input */
.option-card:first-of-type .option-content {
    display: block;
}

.option-card:first-of-type input[type="time"] {
    margin-top: 8px;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

@media (min-width: 1200px) {
    body {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* Dark Mode */
/* @media (prefers-color-scheme: dark) {
            body {
                background: linear-gradient(135deg, #121212, #1c1c1c);
                color: #f1f1f1;
                transition: background 0.3s ease, color 0.3s ease;
            }

            #toggle-button img,
            .weather-detail img {
                filter: brightness(0.9) invert(1);
                transition: filter 0.3s ease;
            }

            #settings-panel {
                background-color: #2a2a2a;
                border-right: 1px solid #444;
                transition: background-color 0.3s ease, border-color 0.3s ease;
            }

            .location-card,
            #current-location {
                background-color: #333;
                color: #f1f1f1;
                border: 1px solid #555;
                transition: background-color 0.3s ease, border-color 0.3s ease;
            }

            .location-card:hover,
            #current-location:hover {
                background-color: #444;
            }

            #refresh-button {
                color: #f1f1f1;
            }

            footer {
                color: #aaa;
            }
        } */

/* Minutely precipitation section styling */
#minutely-precipitation-section {
    margin-bottom: 20px;
    display: none; /* Hidden by default */
}

/* No longer needed as the button is inside the section */
/* #minutely-precipitation-section[style*="display: none"] ~ #minutely-forecast-chart,
#minutely-precipitation-section[style*="display:none"] ~ #minutely-forecast-chart {
    display: none !important;
} */

/* Ensure the refresh button is only visible when the section is visible */
#refresh-minutely-chart {
    display: inline-block;
}

#minutely-precipitation-section[style*="display: none"] #refresh-minutely-chart {
    display: none !important;
}

#minutely-precipitation-section h2 {
    font-weight: var(--font-weight-bold);
    /* color: rgb(121, 188, 232); */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* #minutely-precipitation-section h2::before {
    content: "";
    background-image: url('img/rain.svg');
    background-size: contain;
    background-repeat: no-repeat;
    width: 24px;
    height: 24px;
    display: inline-block;
    margin-right: 10px;
} */

#minutely-precipitation-chart {
    margin-bottom: 20px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Add new animation for the pulsating chart effect */
@keyframes chartPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Specific style for minutely chart container */
#minutely-precipitation-section .chart-container {
    position: relative;
    width: 90%;
    height: 250px;
    margin: 0 auto;
    animation: none; /* Remove default animation as we're using JavaScript for pulsation */
}

/* Add styles for the precipitation detail - clickable element */
.precipitation-detail {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.precipitation-detail:hover {
    transform: scale(1.05);
}

.precipitation-detail:active {
    transform: scale(0.98);
}

.hidden-minutely-trigger {
    z-index: 2;
}

.option-card:has(#tomorrow-api-key) .option-content {
    display: block;
}

/* Reset all previous API key styles */
.option-card.api-key-option {
    padding: 10px;
    box-sizing: border-box;
}

.option-card.api-key-option .option-content {
    display: block;
}

.option-card.api-key-option label {
    display: block;
    margin-bottom: 5px;
    font-weight: var(--font-weight-medium);
}

#tomorrow-api-key {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    margin: 5px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.api-key-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    word-break: normal;
}

.api-key-info a {
    color: #0077cc;
    text-decoration: none;
}

.api-key-info a:hover {
    text-decoration: underline;
}

#api-key-message {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 10px auto 10px auto;
    max-width: 90%;
    text-align: center;
}

#api-key-message p {
    margin-bottom: 10px;
}

#api-key-message a {
    color: #0077cc;
    font-weight: 500;
    text-decoration: none;
}

#api-key-message a:hover {
    text-decoration: underline;
}

.option-card, 
.option-content,
#tomorrow-api-key,
.api-key-info {
    box-sizing: border-box;
}

#minutely-forecast-chart button.disabled-button {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9e9e9;
    color: #999;
}

#minutely-forecast-chart {
    margin-top: 0;
    margin-bottom: 0;
}

#minutely-forecast-chart br {
    display: none;
}

#minutely-precipitation-section .chart-container.collapsed {
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    visibility: hidden;
}

/* Weather Scene Styling */
.weather-scene-container {
    position: relative;
    margin: 0 auto 20px;
    width: calc(85% - 60px); /* Reduced width to account for chart margins/labels */
    max-width: calc(1200px - 60px); /* Reduced max-width to account for chart margins/labels */
    margin-left: auto;
    margin-right: auto;
    /* Add padding to center it relative to chart content area */
    transform: translateX(5px); /* Fine-tune horizontal alignment */
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out, margin 0.5s ease-in-out;
}

.weather-scene-container.visible {
    max-height: 500px;
    opacity: 1;
    margin: 40px auto 50px;
    transform: translateX(5px); /* Maintain horizontal alignment when visible */
}

.weather-scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.weather-scene-header h3 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: #333;
}

.weather-scene-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.weather-scene-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

#weather-scene-content {
    position: relative;
    height: 350px;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
}

#weather-scene-content canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .weather-scene-container {
        width: calc(95% - 30px); /* Smaller reduction for mobile */
        transform: translateX(3px); /* Smaller offset for mobile */
    }
    
    .weather-scene-container.visible {
        transform: translateX(3px); /* Maintain alignment on mobile */
    }
    
    .weather-scene-header {
        padding: 12px 15px;
    }
    
    #weather-scene-content {
        height: 280px;
    }
}