:root {
    --transition-speed: 0.3s;
    --card-border-radius: 8px;
    --card-padding: 1rem;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --rating-good-bg: rgba(46, 204, 113, 0.2);
    --rating-good-border: #2ecc71;
    --rating-moderate-bg: rgba(241, 196, 15, 0.2);
    --rating-moderate-border: #f1c40f;
    --rating-warning-bg: rgba(230, 126, 34, 0.2);
    --rating-warning-border: #e67e22;
    --rating-bad-bg: rgba(231, 76, 60, 0.2);
    --rating-bad-border: #e74c3c;
    --rating-very-bad-bg: rgba(192, 57, 43, 0.2);
    --rating-very-bad-border: #c0392b;
    --rating-cold-bg: rgba(52, 152, 219, 0.2);
    --rating-cold-border: #3498db;
    --rating-cool-bg: rgba(41, 128, 185, 0.2);
    --rating-cool-border: #2980b9;
    --rating-warm-bg: rgba(243, 156, 18, 0.2);
    --rating-warm-border: #f39c12;
    --font-size-xs: 0.75rem;    /* 12px - smallest text, supplementary info */
    --font-size-sm: 0.875rem;   /* 14px - secondary text */
    --font-size-base: 1rem;     /* 16px - body text */
    --font-size-lg: 1.125rem;   /* 18px - important info */
    --font-size-xl: 1.25rem;    /* 20px - sub headings */
    --font-size-2xl: 1.5rem;    /* 24px - main headings */
    --font-size-3xl: 2rem;      /* 32px - large displays */
}

body {
    font-family: "Arial", sans-serif;
    margin: 0;
    padding: 0;
    transition: all var(--transition-speed) ease;
}

/* Light Themes */
.theme-arctic-blast {
    --header-bg: #3498db;
    --bg-color: var(--header-bg);
    --text-color: #333333;
    --card-bg: #ffffff;
    --card-border: #e0e0e0;
    --highlight: #2ecc71;
}

.theme-desert-sand {
    --header-bg: #d7ccc8;
    --bg-color: var(--header-bg);
    --text-color: #5d4037;
    --card-bg: #fff3e0;
    --card-border: #bcaaa4;
    --highlight: #ff7043;
}

.theme-sky-blue {
    --header-bg: #bbdefb;
    --bg-color: var(--header-bg);
    --text-color: #1565c0;
    --card-bg: #ffffff;
    --card-border: #90caf9;
    --highlight: #ffa726;
}

/* Combine common theme properties */
.theme-arctic-blast,
.theme-desert-sand,
.theme-sky-blue {
    --bg-color: var(--header-bg);
    --card-bg: #ffffff;
}

/* Dark Themes */
.theme-midnight-black {
    --header-bg: #1f1f1f;
    --bg-color: var(--header-bg);
    --text-color: #ffffff;
    --card-bg: #2c2c2c;
    --card-border: #3f3f3f;
    --highlight: #bb86fc;
}

.theme-ocean-deep {
    --header-bg: #172a45;
    --bg-color: var(--header-bg);
    --text-color: #e6f1ff;
    --card-bg: #1f3a60;
    --card-border: #2a4a7f;
    --highlight: #64ffda;
}

.theme-forest-green {
    --header-bg: #2d3f3a;
    --bg-color: var(--header-bg);
    --text-color: #d8e8e3;
    --card-bg: #34453f;
    --card-border: #40534c;
    --highlight: #9cc5a1;
}

/* Synthwave Themes */
.theme-neon-night {
    --header-bg: #16213e;
    --bg-color: var(--header-bg);
    --text-color: #f0e68c;
    --card-bg: #0f3460;
    --card-border: #e94560;
    --highlight: #ff00ff;
}

.theme-cyber-future {
    --header-bg: #091833;
    --bg-color: var(--header-bg);
    --text-color: #0abdc6;
    --card-bg: #133e7c;
    --card-border: #091833;
    --highlight: #ea00d9;
}

.theme-retro-vibes {
    --header-bg: #47366d;
    --bg-color: var(--header-bg);
    --text-color: #ff6b97;
    --card-bg: #3d2e5e;
    --card-border: #47366d;
    --highlight: #05ffa1;
}

.theme-code-night {
    --header-bg: #21252b;
    --bg-color: var(--header-bg);
    --text-color: #abb2bf;
    --card-bg: #3e4451;
    --card-border: #181a1f;
    --highlight: #e06c75;
}

.theme-vampire-blood {
    --header-bg: #44475a;
    --bg-color: var(--header-bg);
    --text-color: #f8f8f2;
    --card-bg: #6272a4;
    --card-border: #bd93f9;
    --highlight: #ff79c6;
}

.theme-modern-gray {
    --header-bg: #37474f;
    --bg-color: var(--header-bg);
    --text-color: #eeffff;
    --card-bg: #2e3c43;
    --card-border: #546e7a;
    --highlight: #80cbc4;
}

.theme-owl-night {
    --header-bg: #1d3b53;
    --bg-color: var(--header-bg);
    --text-color: #d6deeb;
    --card-bg: #011627;
    --card-border: #5f7e97;
    --highlight: #c792ea;
}

.theme-night-pale {
    --header-bg: #1b1e2b;
    --bg-color: var(--header-bg);
    --text-color: #a6accd;
    --card-bg: #2e3440;
    --card-border: #676e95;
    --highlight: #82aaff;
}

.theme-cobalt-blue {
    --header-bg: #0f3a51;
    --bg-color: var(--header-bg);
    --text-color: #ffffff;
    --card-bg: #193549;
    --card-border: #4f99d3;
    --highlight: #ff9d00;
}

.theme-monokai-pink {
    --header-bg: #403e41;
    --bg-color: var(--header-bg);
    --text-color: #fcfcfa;
    --card-bg: #2d2a2e;
    --card-border: #75715e;
    --highlight: #f92672;
}

.theme-dark-ayu {
    --header-bg: #0d1016;
    --bg-color: var(--header-bg);
    --text-color: #b3b1ad;
    --card-bg: #0a0e14;
    --card-border: #1f2329;
    --highlight: #ffcc66;
}

.theme-synthwave {
    --header-bg: #3a2d5e;
    --bg-color: var(--header-bg);
    --text-color: #ffffff;
    --card-bg: #2b213a;
    --card-border: #ff79c6;
    --highlight: #f8f8f2;
}

.theme-nordic-winter {
    --header-bg: #3b4252;
    --bg-color: var(--header-bg);
    --text-color: #d8dee9;
    --card-bg: #4c566a;
    --card-border: #81a1c1;
    --highlight: #88c0d0;
}

/* GitHub Dark Theme */
.theme-github-night {
    --header-bg: #161b22;
    --bg-color: var(--header-bg);
    --text-color: #c9d1d9;
    --card-bg: #0d1117;
    --card-border: #30363d;
    --highlight: #58a6ff;
}

/* Atom One Light Theme */
.theme-atom-bright {
    --header-bg: #e5e5e5;
    --bg-color: var(--header-bg);
    --text-color: #383a42;
    --card-bg: #ffffff;
    --card-border: #d4d4d4;
    --highlight: #0184bc;
}

/* Horizon Theme */
.theme-horizon-glow {
    --header-bg: #232530;
    --bg-color: var(--header-bg);
    --text-color: #e3e6ee;
    --card-bg: #1c1e26;
    --card-border: #2e303e;
    --highlight: #e95678;
}

/* Combine common theme properties */
.theme-midnight-black,
.theme-ocean-deep,
.theme-forest-green,
.theme-neon-night,
.theme-cyber-future,
.theme-retro-vibes,
.theme-code-night {
    --bg-color: var(--header-bg);
    --card-bg: var(--header-bg);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

header {
    display: flex;
    justify-content: space-between; /* Distribute space between items */
    align-items: center;
    background-color: var(--header-bg);
    color: var(--text-color);
    padding: 0.3rem; /* Adjust padding as needed */
    position: relative; /* Ensure the header is the reference for absolute positioning */
}

.header-content {
    display: flex;
    justify-content: center; /* Center the content horizontally */
    flex: 1; /* Allow the header content to take up available space */
}

h1 {
    margin: 0;
    font-size: var(--font-size-xl);
    text-align: center; /* Center the text */
    width: 100%; /* Ensure the text is centered within the flex container */
}

#theme-toggle {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    transition: transform var(--transition-speed);
    position: relative; /* Position it relatively within the flex container */
    right: 0; /* Align it to the right */
}

#theme-toggle:hover {
    transform: scale(1.2) rotate(15deg);
}

/* #theme-toggle::after {
    content: "Click me!";
    position: absolute;
    background-color: var(--highlight);
    color: var(--bg-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

#theme-toggle:hover::after {
    opacity: 1;
} */

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--card-padding);
}

section {
    background-color: var(--card-bg);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1rem;
    padding: var(--card-padding);
    position: relative;
}

.source-info-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: var(--font-size-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.3s;
    z-index: 10;
}

.source-info-btn:hover {
    opacity: 1;
}

.source-info-tooltip {
    display: none;
    position: absolute;
    bottom: 30px;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 8px;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    white-space: pre-wrap;
    z-index: 1000;
    color: var(--text-color);
    box-shadow: var(--card-shadow);
    max-width: 300px;
}

h2 {
    color: var(--highlight);
    border-bottom: 2px solid var(--highlight);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

#conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.condition-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-border-radius);
    padding: 0.5rem; /* Reduce padding */
    margin-bottom: 0.5rem; /* Reduce margin */
    transition: all var(--transition-speed) ease;
}

.condition-card strong {
    display: block;
    margin-bottom: 0.25rem;
}

.condition-card span {
    font-size: var(--font-size-lg);
}

.condition-card small {
    display: block;
    margin-top: 0.25rem;
    font-size: var(--font-size-xs);
    font-style: italic;
}

/* Rating classes */
.rating-good {
    background-color: var(--rating-good-bg);
    border-color: var(--rating-good-border);
}

.rating-moderate {
    background-color: var(--rating-moderate-bg);
    border-color: var(--rating-moderate-border);
}

.rating-warning {
    background-color: var(--rating-warning-bg);
    border-color: var(--rating-warning-border);
}

.rating-bad {
    background-color: var(--rating-bad-bg);
    border-color: var(--rating-bad-border);
}

.rating-very-bad {
    background-color: var(--rating-very-bad-bg);
    border-color: var(--rating-very-bad-border);
}

.rating-cold {
    background-color: var(--rating-cold-bg);
    border-color: var(--rating-cold-border);
}

.rating-cool {
    background-color: var(--rating-cool-bg);
    border-color: var (--rating-cool-border);
}

.rating-warm {
    background-color: var(--rating-warm-bg);
    border-color: var(--rating-warm-border);
}

#video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

#tide-canvas {
    width: 100%;
    height: 300px;
}

footer {
    text-align: center;
    padding: var(--card-padding);
    font-size: var(--font-size-sm);
    color: var(--text-color);
}

.error-message {
    background-color: var(--rating-bad-bg);
    border: 1px solid var(--rating-bad-border);
    color: var (--rating-bad-border);
    padding: var (--card-padding);
    margin-bottom: 1rem;
    border-radius: var(--card-border-radius);
}

@media (max-width: 768px) {
    #conditions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #video-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #conditions-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: var(--font-size-lg);
    }

    #theme-toggle {
        font-size: var(--font-size-xl);
    }
}

.theme-control {
    display: flex;
    align-items: center;
}

#theme-name {
    font-size: var(--font-size-sm);
    color: var(--text-color);
    opacity: 0.8;
}

.theme-dropdown {
    position: relative;
    display: inline-block;
}

.theme-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    box-shadow: var(--card-shadow);
    border-radius: var(--card-border-radius);
    z-index: 1;
    max-height: 200px;
    overflow-y: auto;
}

.theme-dropdown-content button {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.theme-dropdown-content button:hover {
    background-color: var(--highlight);
    color: var(--bg-color);
}

.theme-dropdown:hover .theme-dropdown-content {
    display: block;
}

.theme-preview-page {
    display: none;  /* Default state is hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
    box-sizing: border-box;
}

.theme-preview-page.active {
    display: grid;  /* Show as grid when active */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.theme-preview {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    width: 100%;
    box-sizing: border-box;
}

.theme-preview canvas {
    width: 100%;
    height: 100px;
    margin-bottom: 0.25rem;
}

.theme-preview button {
    background-color: var(--highlight);
    color: var(--bg-color);
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    margin-top: 1rem;
    display: block;
    width: 100%;
    text-align: center;
    font-size: var(--font-size-sm);
}

.theme-preview button:hover {
    background-color: var(--highlight);
    color: var(--bg-color);
}

.theme-preview h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: var(--font-size-base);
}

.chart-toggles {
    padding: 5px;
    border-radius: var(--card-border-radius);
    background-color: var(--card-bg);
}

.chart-toggles label {
    cursor: pointer;
    user-select: none;
}

.chart-toggles input[type="checkbox"] {
    cursor: pointer;
}

.current-weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--card-bg);
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.weather-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
}

.weather-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 1rem;
}

.weather-primary {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center the content horizontally */
    justify-content: center; /* Center the content vertically */
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
}

.weather-icon {
    font-size: 4rem; /* Adjust icon size */
    display: flex;
    align-items: center;
    justify-content: center;
}

.description {
    font-size: var(--font-size-base);
    font-weight: 500;
    text-align: center; /* Center the description text */
    margin-top: 0.5rem; /* Add some margin to separate from the top section */
}

.temp-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align to the start */
    gap: 0.25rem;
}

.current-temp {
    font-size: var(--font-size-2xl);
    font-weight: bold;
}

.wind-info {
    font-size: var(--font-size-base);
}

.weather-secondary {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the content */
    gap: 0.25rem; /* Adjust gap */
    width: 100%;
    box-sizing: border-box;
}

.weather-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align to the start */
    gap: 0.5rem;
}

.detailed-forecast {
    font-size: var(--font-size-sm);
    line-height: 1.2; /* Adjust line height */
    opacity: 0.9;
    margin: 0;
}

.forecast-timeline {
    display: flex;
    overflow-x: auto;
    padding: 0.25rem 0; /* Reduce padding */
    width: 100%;
    box-sizing: border-box;
}

.forecast-hour {
    flex: 0 0 auto;
    text-align: center;
    margin-right: 0.25rem; /* Reduce margin */
}

.forecast-time {
    font-size: var(--font-size-xs);
}

.forecast-icon {
    font-size: var(--font-size-lg);
}

.forecast-temp, .forecast-precipitation {
    font-size: var(--font-size-xs);
}

.day-divider {
    width: 100%;
    font-size: var(--font-size-xs);
    text-align: center;
    font-weight: bold;
    margin: 0.5rem 0;
    border-top: 1px solid var(--card-border);
    padding-top: 0.5rem;
    color: var(--highlight);
}

/* Responsive styles for theme preview */
@media (max-width: 600px) {
    .theme-preview-page.active {
        grid-template-columns: repeat(2, 1fr);
        padding: 0.25rem;
        gap: 0.25rem;
    }
    
    .theme-preview canvas {
        height: 80px;
    }
}

@media (min-width: 601px) {
    .theme-preview-page.active {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
}

.theme-preview button {
    background-color: var(--highlight);
    color: var(--bg-color);
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    margin-top: 1rem;
    display: block;
    width: 100%;
    text-align: center;
}

.theme-preview button:hover {
    background-color: var(--highlight);
    color: var(--bg-color);
}

.theme-preview h3 {
    text-align: center;
    margin-bottom: 1rem;
}

.chart-toggles {
    padding: 5px;
    border-radius: var(--card-border-radius);
    background-color: var(--card-bg);
}

.chart-toggles label {
    cursor: pointer;
    user-select: none;
}

.chart-toggles input[type="checkbox"] {
    cursor: pointer;
}

.current-weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--card-bg);
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.weather-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
}

.weather-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 1rem;
}

.weather-primary {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center the content horizontally */
    justify-content: center; /* Center the content vertically */
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
}

.weather-icon {
    font-size: 4rem; /* Adjust icon size */
    display: flex;
    align-items: center;
    justify-content: center;
}

.description {
    font-size: var(--font-size-base);
    font-weight: 500;
    text-align: center; /* Center the description text */
    margin-top: 0.5rem; /* Add some margin to separate from the top section */
}

.temp-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align to the start */
    gap: 0.25rem;
}

.current-temp {
    font-size: var(--font-size-2xl);
    font-weight: bold;
}

.wind-info {
    font-size: var(--font-size-base);
}

.weather-secondary {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the content */
    gap: 0.25rem; /* Adjust gap */
    width: 100%;
    box-sizing: border-box;
}

.weather-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align to the start */
    gap: 0.5rem;
}

.detailed-forecast {
    font-size: var(--font-size-sm);
    line-height: 1.2; /* Adjust line height */
    opacity: 0.9;
    margin: 0;
}

.forecast-timeline {
    display: flex;
    overflow-x: auto;
    padding: 0.25rem 0; /* Reduce padding */
    width: 100%;
    box-sizing: border-box;
}

.forecast-hour {
    flex: 0 0 auto;
    text-align: center;
    margin-right: 0.25rem; /* Reduce margin */
}

.forecast-time {
    font-size: var(--font-size-xs);
}

.forecast-icon {
    font-size: var(--font-size-lg);
}

.forecast-temp, .forecast-precipitation {
    font-size: var(--font-size-xs);
}

.day-divider {
    width: 100%;
    font-size: var(--font-size-xs);
    text-align: center;
    font-weight: bold;
    margin: 0.5rem 0;
    border-top: 1px solid var(--card-border);
    padding-top: 0.5rem;
    color: var(--highlight);
}

.youtube-placeholder {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    cursor: pointer;
    background-color: var(--card-bg);
}

.youtube-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-placeholder .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.youtube-placeholder:hover .play-button {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Update existing iframe styles */
.youtube-placeholder iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

lite-youtube {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    background-color: var(--card-bg);
    cursor: pointer;
    position: relative;
}

lite-youtube iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
}

lite-youtube img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

lite-youtube .lyt-playbtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.3s;
}

lite-youtube:hover .lyt-playbtn {
    background-color: rgba(0, 0, 0, 0.9);
}

.video-container h3 {
    font-size:medium
}