:root {
    --md-primary: #5856d6;
    --md-primary-hover: #2c2c2c;
    --md-on-primary: #FFFFFF;
    --md-surface: #FFFBFE;
    --md-surface-1: #F7F2FA;
    --md-surface-2: #F3EDF7;
    --md-elevation-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.14);
    --md-elevation-2: 0 3px 6px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12);
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: var(--md-surface);
    color: #1C1B1F;
    height: 100svh;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
}

.navbar {
    background-color: var(--md-surface);
    padding: 16px 24px;
    box-shadow: var(--md-elevation-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--md-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-bar {
    background: var(--md-surface-1);
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    width: calc(100% - 50%);
    max-width: 240px;
}

.search-bar input {
    border: none;
    background: none;
    padding: 4px;
    width: 100%;
    outline: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 32px 0;
}

.radio-card {
    background: var(--md-surface);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: var(--md-elevation-1);
    border: 1px solid var(--md-primary);
}

.radio-card:hover {
    box-shadow: var(--md-elevation-2);
    background: var(--md-surface-1);
    border: 1px solid var(--md-primary-hover);
}

.radio-icon {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin: 0 auto 16px;
    display: block;
    box-shadow: var(--md-elevation-1);
}

.radio-card h3 {
    margin: 0;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
}

.radio-card p {
    margin: 8px 0 0;
    text-align: center;
    color: #49454F;
    font-size: 0.9rem;
}

.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--md-surface);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
    padding: 16px 24px;
    display: none;
    z-index: 1000;
}

.player-content {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.now-playing-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.now-playing-icon:hover {
    transform: scale(1.05);
}

.player-info {
    flex-grow: 1;
}

.player-info h4 {
    margin: 0;
    font-weight: 500;
}

.player-info p {
    margin: 4px 0 0;
    color: #49454F;
    font-size: 0.9rem;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-controls button {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-controls button:hover {
    background: #7B65B5;
    transform: scale(1.05);
}

.player-controls button.loading {
    animation: spin 1s linear infinite;
    opacity: 0.8;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--md-surface);
    border-radius: 28px;
    width: 90%;
    max-width: 480px;
    height: 90svh;
    padding: 15px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    padding: 5px;
    color: #49454F;
}

.modal-close:hover {
    background: var(--md-primary-hover);
}

.modal-radio-icon {
    width: 230px;
    height: 230px;
    border-radius: 10px;
    margin: 0 auto 15px;
    display: block;
}

.wave-visualizer {
    height: 60px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.wave-visualizer.active {
    opacity: 1;
}

.wave-bar {
    width: 4px;
    height: 20px;
    background: var(--md-primary);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
    animation-play-state: paused;
}

.wave-visualizer.active .wave-bar {
    animation-play-state: running;
}

@keyframes wave {
    50% { height: 60px; }
}

.modal-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.modal-controls button {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-controls button:hover {
    background: #7B65B5;
}

.modal-controls button.loading {
    animation: spin 1s linear infinite;
    opacity: 0.8;
}

.volume-control {
    margin: 10px auto;
    width: 90%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px;
    background: var(--md-surface-1);
    border-radius: 12px;
}

.volume-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--md-surface-2);
    outline: none;
    transition: height 0.2s ease;
    position: relative;
}

.volume-slider:hover {
    height: 8px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--md-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-top: -9px; /* Center the thumb */
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.25);
}

.volume-slider::-webkit-slider-runnable-track {
    background: var(--md-primary);
    height: 6px;
    border-radius: 3px;
}

/* Hide native audio controls */
audio::-webkit-media-controls {
    display: none !important;
}

audio {
    display: none;
}

.radio-address {
    margin: 4px 0 0;
    color: #49454F;
    font-size: 0.9rem;
    text-align: center;
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px;
    scrollbar-width: none;
    scrollbar-color: var(--md-primary) transparent;
}

.radio-address::-webkit-scrollbar {
    display: none;
}

.radio-address::-webkit-scrollbar-thumb {
    display: none;
}

.modal-radio-info {
    text-align: center;
    margin: 5px 0;
}

.modal-radio-info h3,
.modal-radio-info p {
    margin: 8px 0;
}

@media (max-width: 480px) {
    .radio-address {
        margin: 10px 0 0;
    }
    .volume-control {
        margin: 20px auto;
    }
    .modal-controls {
        margin-top: 20px;
    }
    .modal-radio-info {
        margin: 15px 0;
    }
    .modal-radio-info h3,
    .modal-radio-info p {
        margin: 5px 0;
    }
    .modal-radio-icon {
        width: 240px;
        height: 240px;
        margin: 10px auto;
    }
}
