/* ============================================
   REZMO.IO - Radio Garden Clone
   Global Radio Visualization Platform
   ============================================ */

:root {
    --color-bg: #1a1a2e;
    --color-bg-dark: #0f0f1a;
    --color-primary: #4ade80;
    --color-primary-dim: rgba(74, 222, 128, 0.3);
    --color-primary-glow: rgba(74, 222, 128, 0.5);
    --color-secondary: #22d3ee;
    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.6);
    --color-text-dim: rgba(255, 255, 255, 0.3);
    --color-panel: rgba(15, 15, 26, 0.9);
    --color-panel-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--color-bg-dark);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Globe Container
   ============================================ */

#globe-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 100%);
}

#globe-container canvas {
    display: block;
    cursor: grab;
}

#globe-container canvas:active {
    cursor: grabbing;
}

/* ============================================
   Tuning Ring (Center Indicator)
   ============================================ */

.tuning-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.tuning-ring.active {
    opacity: 1;
}

.tuning-ring svg {
    width: 100%;
    height: 100%;
}

.tuning-ring .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2;
}

.tuning-ring .ring-progress {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.tuning-ring.tuned .ring-progress {
    stroke-dashoffset: 0;
}

.tuning-ring.locked .ring-progress {
    stroke: var(--color-secondary);
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.5));
}

/* ============================================
   UI Overlay
   ============================================ */

.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.ui-overlay > * {
    pointer-events: auto;
}

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    pointer-events: none;
}

.logo {
    display: flex;
    align-items: baseline;
    pointer-events: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.logo-dot {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--color-primary);
}

.header-right {
    pointer-events: auto;
}

.station-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================
   Station Panel
   ============================================ */

.station-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--color-panel) 0%, transparent 100%);
    padding: 60px 30px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    transform: translateY(20px);
    opacity: 0;
    transition: transform var(--transition-medium), opacity var(--transition-medium);
}

.station-panel.visible {
    transform: translateY(0);
    opacity: 1;
}

.panel-content {
    flex: 1;
    min-width: 0;
}

.station-location {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.station-name {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.station-codec {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.now-playing {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--color-text-dim);
    font-style: italic;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.now-playing.visible {
    opacity: 1;
}

/* ============================================
   Audio Controls
   ============================================ */

.audio-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: var(--color-bg-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 4px 20px var(--color-primary-glow);
    position: relative;
}

.play-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 30px var(--color-primary-glow);
}

.play-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.play-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    cursor: not-allowed;
}

.play-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.play-btn .icon-play,
.play-btn .icon-pause,
.play-btn .icon-loading {
    position: absolute;
    transition: opacity var(--transition-fast);
}

.play-btn .icon-pause,
.play-btn .icon-loading {
    opacity: 0;
}

.play-btn.playing .icon-play {
    opacity: 0;
}

.play-btn.playing .icon-pause {
    opacity: 1;
}

.play-btn.loading .icon-play,
.play-btn.loading .icon-pause {
    opacity: 0;
}

.play-btn.loading .icon-loading {
    opacity: 1;
    animation: spin 1s linear infinite;
}

.play-btn .icon-loading circle {
    stroke: currentColor;
    stroke-dasharray: 40;
    stroke-dashoffset: 10;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Lock Button */
.lock-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.lock-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--color-text);
}

.lock-btn.locked {
    border-color: var(--color-secondary);
    background: var(--color-secondary);
    color: var(--color-bg-dark);
    box-shadow: 0 2px 12px rgba(34, 211, 238, 0.5);
}

.lock-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    position: absolute;
    transition: opacity var(--transition-fast);
}

.lock-btn .icon-locked {
    opacity: 0;
}

.lock-btn .icon-unlocked {
    opacity: 1;
}

.lock-btn.locked .icon-locked {
    opacity: 1;
}

.lock-btn.locked .icon-unlocked {
    opacity: 0;
}

.lock-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-icon {
    width: 20px;
    height: 20px;
    fill: var(--color-text-muted);
}

.volume-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-text);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-text);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* ============================================
   Instructions
   ============================================ */

.instructions {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.instructions p {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    letter-spacing: 0.05em;
}

.instructions.hidden {
    opacity: 0;
}

/* ============================================
   Coordinates
   ============================================ */

.coordinates {
    position: fixed;
    bottom: 30px;
    right: 30px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--color-text-dim);
    letter-spacing: 0.05em;
    pointer-events: none;
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.globe-icon {
    width: 80px;
    height: 80px;
    position: relative;
}

.globe-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    opacity: 0.3;
}

.globe-ring:nth-child(1) {
    width: 60px;
    height: 60px;
    animation: ringPulse 2s ease-in-out infinite;
}

.globe-ring:nth-child(2) {
    width: 40px;
    height: 40px;
    animation: ringPulse 2s ease-in-out infinite 0.3s;
}

.globe-ring:nth-child(3) {
    width: 20px;
    height: 20px;
    animation: ringPulse 2s ease-in-out infinite 0.6s;
}

@keyframes ringPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

.loading-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .station-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 40px 20px 20px;
        gap: 20px;
    }

    .audio-controls {
        justify-content: center;
    }

    .play-btn {
        width: 56px;
        height: 56px;
    }

    .volume-control {
        display: none;
    }

    .tuning-ring {
        width: 60px;
        height: 60px;
    }

    .coordinates {
        display: none;
    }

    .instructions {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .station-name {
        font-size: 1.3rem;
    }

    .station-panel {
        padding: 30px 15px 15px;
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
.play-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

.volume-slider:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* ============================================
   Filter Buttons
   ============================================ */

.filter-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: auto;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--color-panel);
    border-radius: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-panel-border);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90vw;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
    background: var(--color-primary);
    color: var(--color-bg-dark);
}

.filter-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Mobile filter auto-hide */
.filter-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-20px);
}

@media (max-width: 768px) {
    .filter-container {
        top: 70px;
        left: 10px;
        right: 10px;
        transform: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .filter-container.hidden {
        transform: translateY(-20px);
    }

    .filter-buttons {
        gap: 6px;
        padding: 6px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.65rem;
    }
}
