:root {
    /* Light mode variables */
    --primary: #2d3436;
    --secondary: #636e72;
    --background: #ffffff;
    --surface: #f8f9fa;
    --accent: #3498db;
    --accent-light: #74b9ff;
    --loading-bar-bg: #ddd; /* Background of the progress bar */
    --loading-bar-color: var(--accent); /* Color of the progress */
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.05);
    --gradient-bg: linear-gradient(145deg, #f6f9fc, #ebf1f8);
}

/* Dark mode variables - applied when data-theme="dark" is set on html element */
[data-theme="dark"] {
    --primary: #dfe6e9;
    --secondary: #b2bec3;
    --background: #121212;
    --surface: #1e1e1e;
    --accent: #74b9ff;
    --accent-light: #0984e3;
    --loading-bar-bg: #333;
    --card-bg: rgba(30, 30, 30, 0.95);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.2);
    --gradient-bg: linear-gradient(145deg, #1a1a1a, #121212);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--primary);
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--gradient-bg);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Remove theme switch styles since we're not using the UI toggle anymore */
.theme-switch-wrapper,
.theme-switch,
.theme-icon,
.sun-icon,
.moon-icon,
.slider {
    display: none;
}

.player {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    width: 90%;
    max-width: 400px;
    margin: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Station info */
.station-info {
    text-align: center;
    margin: 4rem 0 2rem; /* Increase top margin to create more space */
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 2rem; /* Add padding to accommodate the init-status */
}

.flag {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.flag:hover {
    transform: scale(1.05);
}

.station-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.genres {
    color: var(--secondary);
    font-size: 0.9rem;
    max-width: 300px;
    line-height: 1.4;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
}

button {
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 120px;
    height: 48px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(0);
}

/* Fix the discoverButton styling to use consistent colors that work in both modes */
#discoverButton {
    background: var(--accent);
    color: white;
}

#discoverButton:hover {
    background: var(--accent-light);
    color: white;
}

#discoverButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#pauseResumeButton {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid rgba(0,0,0,0.1);
}

#pauseResumeButton:hover {
    background: var(--surface);
    opacity: 0.9;
}

#pauseResumeButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

input[type="range"] {
    width: 100%;
    margin: 1.5rem 0;
    accent-color: var(--primary);
    cursor: pointer;
    height: 6px;
    border-radius: 6px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Loading state */
.loading-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-container.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(127,127,127,0.2);
    border-left-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

.fun-fact {
    max-width: 80%;
    text-align: center;
    font-size: 1rem;
    line-height: 1.5;
    padding: 1rem;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.5s ease 0.2s forwards;
}

/* Equalizer animation */
.equalizer {
    display: flex;
    gap: 4px;
    height: 16px;
    align-items: flex-end;
}

.equalizer-bar {
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    animation: equalize 1.2s ease infinite;
}

.equalizer-bar:nth-child(1) { animation-delay: -0.4s; height: 8px; }
.equalizer-bar:nth-child(2) { animation-delay: -1.0s; height: 16px; }
.equalizer-bar:nth-child(3) { animation-delay: -0.2s; height: 10px; }
.equalizer-bar:nth-child(4) { animation-delay: -0.9s; height: 18px; }
.equalizer-bar:nth-child(5) { animation-delay: -0.6s; height: 14px; }

.playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.playing-indicator.active {
    opacity: 1;
}

.playing-indicator-text {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: flex-end;
    height: 24px;
}

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

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

@keyframes equalize {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

@media (max-width: 480px) {
    .player {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .station-title {
        font-size: 1.2rem;
    }
    
    .fun-fact {
        font-size: 0.9rem;
    }
}
/* Progress Bar */
.loading-progress {
    width: 80%;
    height: 8px;
    background-color: var(--loading-bar-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}

.loading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background-color: var(--loading-bar-color);
    border-radius: 4px;
    transition: width 0.1s ease-in-out; /* Smooth animation */
}

.loading-progress-bar.indeterminate {
    width: 40%;
    animation: pulse 1.5s infinite ease-in-out;
}

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

.buffer-status {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.text-button {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font: inherit;
    display: inline;
}

.text-button:hover {
    color: var(--accent-light);
}

/* Status Clock Animation */
#headingStatus {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-clock {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    position: relative;
}

.status-clock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 2px;
    background: var(--accent);
    transform-origin: left center;
    animation: clock-spin 1s linear infinite;
}

@keyframes clock-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.volume-control {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the content horizontally */
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.volume-icon {
    font-size: 1.2rem;
    color: var(--primary);
}

.volume-control input[type="range"] {
    width: 300px; /* Adjust the width to make it shorter */
    accent-color: var(--primary);
    cursor: pointer;
    height: 6px;
    border-radius: 6px;
}

/* Initialization Status UI */
.init-status {
    margin: 4px 0 0 0;
    padding: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    transition: opacity 0.5s ease;
    height: 24px;
    position: absolute;
    top: 85%; /* Changed from 75% to 85% to position it lower */
    left: 0;
    transform: translateY(-50%); /* Center vertically */
}

#init-message {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 500;
    margin: 0 0 4px 0;
}

.init-progress {
    width: 75%;
    height: 2px;
    background: var(--loading-bar-bg);
    border-radius: 1px;
    overflow: hidden;
}

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

/* Hide controls during initialization */
.controls.initializing {
    opacity: 0.5;
    pointer-events: none;
}