:root {
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border: #e5e7eb;
    --favorite: #ef4444;
}

body.dark-mode {
    --bg-color: #111827;
    --text-color: #f9fafb;
    --card-bg: #1f2937;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --border: #374151;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.search-container {
    padding: 15px 20px 5px;
}

.search-container input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
}

.tabs {
    display: flex;
    padding: 0 20px 10px;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.tab-btn.active {
    background-color: var(--primary);
    color: white;
}

.station-list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 300px;
    overflow-y: auto;
}

.station-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.station-item:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

.station-item.active {
    border-left: 4px solid var(--primary);
    background-color: rgba(59, 130, 246, 0.1);
}

.station-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    font-size: 1.2rem;
    color: var(--border);
}

.fav-btn.is-fav {
    color: var(--favorite);
}

.player-controls {
    padding: 15px 20px 20px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border);
    text-align: center;
}

.now-playing {
    font-size: 0.9rem;
    margin-bottom: 5px;
    opacity: 0.8;
    height: 20px;
}

/* Stream Status Bar */
.stream-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    min-height: 22px;
}

.stream-badge {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--border);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
}

.stream-badge[data-state="live"] {
    background: #16a34a;
    color: white;
    animation: pulse-live 2s infinite;
}

.stream-badge[data-state="buffering"] {
    background: #d97706;
    color: white;
}

.stream-badge[data-state="reconnecting"] {
    background: #7c3aed;
    color: white;
}

.stream-badge[data-state="error"] {
    background: #dc2626;
    color: white;
}

.stream-badge[data-state="paused"] {
    background: var(--border);
    color: var(--text-color);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.keyboard-hint {
    font-size: 0.65rem;
    opacity: 0.4;
    white-space: nowrap;
}

#visualizer {
    width: 100%;
    height: 50px;
    margin-bottom: 10px;
    display: block;
    border-radius: 4px;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.play-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mute-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    transition: transform 0.15s;
    line-height: 1;
}

.mute-btn:hover {
    transform: scale(1.2);
}

.mute-btn.muted {
    opacity: 0.5;
}

/* Modal Design */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    width: 100%;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.theme-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-weight: bold;
}

.setting-group {
    margin-bottom: 20px;
    text-align: left;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

/* Custom Stations */
.custom-input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.custom-station-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.delete-custom-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.15s;
    padding: 0 4px;
}

.delete-custom-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.custom-badge {
    font-size: 0.65rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
}
