/* Base Layout Wrapper */
.radio-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Reset & Base Variables */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --primary-gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 10px 40px 0 rgba(31, 38, 135, 0.1);
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --radius-lg: 24px;
    --radius-md: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    background-color: #f7f9fa;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
}

/* Header */
.radio-header {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.radio-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(102,126,234,0.1) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
    z-index: 0;
}

.header-content, .header-stats {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.radio-icon-header {
    font-size: 2.8rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(102,126,234,0.3));
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-stats {
    display: flex;
    gap: 40px;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.5);
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.8);
}

.stat-number {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 30px;
    min-height: 700px;
    align-items: start;
}

/* Player Section */
.sticky-player {
    position: sticky;
    top: 90px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.player-header {
    margin-bottom: 35px;
}

.station-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.station-icon-large {
    position: relative;
    width: 120px;
    height: 120px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    border: 4px solid white;
    transition: var(--transition);
}

.station-icon-large.playing {
    animation: float 6s ease-in-out infinite;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6), 0 0 0 10px rgba(102, 126, 234, 0.1);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.live-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    border: 3px solid white;
    opacity: 0.5;
    transition: var(--transition);
}

.live-indicator.active {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.station-icon-large .icon {
    font-size: 3.5rem;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.station-info {
    width: 100%;
}

.station-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.2;
}

.station-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.05);
    padding: 6px 16px;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #95a5a6;
    border-radius: 50%;
    transition: var(--transition);
}

.status-dot.playing {
    background: #2ecc71;
    animation: blink 2s infinite;
}

.status-dot.loading {
    background: #f39c12;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Player Controls */
.player-controls {
    margin-bottom: 35px;
}

.controls-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: var(--primary-gradient);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}
.control-btn.disabled {
    background: #b2bec3;
    cursor: not-allowed;
    box-shadow: none;
}
.control-btn.disabled:hover { transform: none; box-shadow: none; }

.control-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    border-radius: 50%;
}

.control-btn:not(.disabled):hover {
    transform: scale(1.08) translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
}

.control-btn:not(.disabled):active {
    transform: scale(0.95);
}

.loading-spinner {
    font-size: 2rem;
    animation: rotate 1.5s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.volume-section {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 15px 20px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 50px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.volume-icon {
    font-size: 1.3rem;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.volume-icon:hover {
    transform: scale(1.2);
}

.volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    outline: none;
    position: relative;
    overflow: hidden;
}

.volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: -100vw 0 0 100vw var(--primary);
    border: 2px solid white;
}

.volume-value {
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 700;
    min-width: 45px;
    text-align: right;
}

/* Visualizer */
.audio-visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 30px;
    margin-top: 20px;
    opacity: 0.2;
    transition: opacity 0.3s;
}

.audio-visualizer.active {
    opacity: 1;
}

.audio-visualizer .bar {
    width: 8px;
    background: var(--primary-gradient);
    border-radius: 4px 4px 0 0;
    transition: height 0.1s ease;
    height: 4px;
}

.audio-visualizer.active .bar {
    animation: equalize 1s infinite alternate;
}

.audio-visualizer .bar:nth-child(1) { animation-delay: -0.2s; animation-duration: 0.8s; }
.audio-visualizer .bar:nth-child(2) { animation-delay: -0.4s; animation-duration: 0.9s; }
.audio-visualizer .bar:nth-child(3) { animation-delay: -0.1s; animation-duration: 1.1s; }
.audio-visualizer .bar:nth-child(4) { animation-delay: -0.6s; animation-duration: 0.7s; }
.audio-visualizer .bar:nth-child(5) { animation-delay: -0.3s; animation-duration: 1.0s; }
.audio-visualizer .bar:nth-child(6) { animation-delay: -0.8s; animation-duration: 0.8s; }
.audio-visualizer .bar:nth-child(7) { animation-delay: -0.5s; animation-duration: 1.2s; }
.audio-visualizer .bar:nth-child(8) { animation-delay: -0.7s; animation-duration: 0.9s; }
.audio-visualizer .bar:nth-child(9) { animation-delay: -0.2s; animation-duration: 0.7s; }
.audio-visualizer .bar:nth-child(10) { animation-delay: -0.9s; animation-duration: 1.1s; }

@keyframes equalize {
    0% { height: 4px; }
    50% { height: 25px; }
    100% { height: 10px; }
}

/* Sleep Timer */
.sleep-timer {
    background: rgba(0,0,0,0.02);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: auto;
    border: 1px dashed rgba(0,0,0,0.1);
}

.sleep-timer h4 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.timer-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 5px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1);
}

.timer-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.timer-input-group input:focus {
    outline: none;
}

.timer-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    padding-right: 15px;
}

.timer-buttons {
    display: flex;
    gap: 10px;
}

.btn-timer {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-timer.start {
    background: var(--text-main);
    color: white;
}

.btn-timer.stop {
    background: #ff4757;
    color: white;
}

.btn-timer:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#cooldown-timer {
    margin-top: 15px;
    background: rgba(255,255,255,0.7);
    padding: 15px;
    border-radius: 12px;
}

.countdown-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.countdown-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.countdown-time {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
}

.progress-container {
    height: 6px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 100%;
    transition: width 1s linear;
}

/* Stations Section */
.stations-container {
    display: flex;
    flex-direction: column;
}

.stations-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255,255,255,0.5);
}

.stations-header h3 {
    font-size: 1.6rem;
    color: var(--text-main);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.stations-tools {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
    flex: 2;
}

.search-box .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: 2px solid transparent;
    background: rgba(0,0,0,0.03);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-main);
    font-weight: 500;
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

/* Clean Category Dropdown */
.category-dropdown-wrapper {
    position: relative;
    flex: 1;
}

.modern-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 16px 40px 16px 20px;
    background: rgba(102, 126, 234, 0.08);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.modern-select:hover, .modern-select:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
}

.select-indicator {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
    font-size: 0.9rem;
}

/* Stations Grid */
.stations-grid {
    flex: 1;
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    align-content: start;
}

/* Station Item */
.station-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.station-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.station-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    border-color: rgba(0,0,0,0.08);
}

.station-item.active {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.05), white);
    border-color: rgba(102, 126, 234, 0.3);
}

.station-item.active::before {
    opacity: 1;
}

/* Inline style hook for active border color */
.station-item[style*="--active-color"].active::before {
    background: var(--active-color);
}

.station-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.station-icon .icon {
    font-size: 1.8rem;
    color: white;
}

.station-details {
    flex: 1;
    min-width: 0;
}

.station-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-category {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0,0,0,0.03);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
}

.station-action {
    flex-shrink: 0;
}

.play-btn-small {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    opacity: 0.8;
}

.station-item:hover .play-btn-small {
    opacity: 1;
    transform: scale(1.1);
}

.station-item.active .play-btn-small {
    opacity: 1;
}

/* Loading Trigger */
.loading-trigger {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-muted);
    font-weight: 600;
    gap: 10px;
    display: none; /* Controlled by JS */
}
.loading-trigger .loading-spinner {
    font-size: 1.2rem;
}

/* Empty State */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-results h4 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 8px;
}

/* Stations Footer */
.stations-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255,255,255,0.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-info {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    background: var(--text-main);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .sticky-player {
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 30px;
    }
    
    .player-header { margin-bottom: 0; flex: 1; min-width: 300px; }
    .player-controls { margin-bottom: 0; flex: 1; min-width: 300px; }
    .sleep-timer { width: 100%; margin-top: 10px; }
    
    .station-display {
        flex-direction: row;
        text-align: left;
    }
    
    .controls-main {
        flex-direction: row;
    }
}

@media (max-width: 768px) {
    .radio-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 20px;
    }
    
    .header-stats {
        justify-content: center;
        width: 100%;
        gap: 15px;
    }
    
    .stat-item {
        flex: 1;
        padding: 10px;
    }
    
    .sticky-player {
        flex-direction: column;
        padding: 20px;
    }
    
    .controls-main {
        flex-direction: column;
        width: 100%;
    }
    
    .stations-tools {
        flex-direction: column;
    }

    .search-box, .category-dropdown-wrapper {
        width: 100%;
    }
    
    .stations-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .stations-header {
        padding: 20px;
    }
    
    .stations-footer {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}
