*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0a0f; --bg-card: #14141e; --bg-input: #1c1c2e;
  --primary: #6c5ce7; --primary-hover: #5a4bd1;
  --text: #e0e0e0; --text-muted: #8888a0; --border: #2a2a3e;
  --danger: #e74c3c; --success: #2ecc71;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.navbar-brand a { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.navbar-links { display: flex; gap: 1rem; align-items: center; }
.nav-link { padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; color: var(--text); transition: background 0.2s; }
.nav-link:hover { background: var(--bg-input); }

.main-content { max-width: 1200px; width: 100%; margin: 0 auto; padding: 2rem 1rem; }

.btn-primary, .btn-secondary, .btn-danger, .btn-sm { display: inline-block; padding: 0.6rem 1.4rem; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-logout { background: transparent; border: 1px solid var(--danger); color: var(--danger); cursor: pointer; padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; }

.hero { text-align: center; padding: 4rem 1rem; }
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero p { color: var(--text-muted); font-size: 1.2rem; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; padding: 3rem 0; }
.feature { background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); }
.feature h3 { margin-bottom: 0.5rem; }
.feature p { color: var(--text-muted); }

.auth-page { display: flex; justify-content: center; padding-top: 3rem; }
.auth-form { background: var(--bg-card); padding: 2.5rem; border-radius: 12px; border: 1px solid var(--border); width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 1rem; }
.auth-form h2 { text-align: center; }
.auth-form p { text-align: center; color: var(--text-muted); font-size: 0.9rem; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.station-status { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.status-indicator { width: 10px; height: 10px; border-radius: 50%; }
.status-indicator.live { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-indicator.offline { background: var(--text-muted); }
.dashboard-controls { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }

.stream-url { background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 2rem; }
.stream-url code { display: block; background: var(--bg-input); padding: 0.8rem; border-radius: 8px; margin: 0.5rem 0; font-size: 0.85rem; word-break: break-all; }
.hint { color: var(--text-muted); font-size: 0.85rem; }

.station-settings { background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.dashboard-section { background: var(--bg-card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 1.5rem; }
.dashboard-section h3 { margin-bottom: 0.8rem; font-size: 1rem; }
.current-song-info { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 0; }
.current-song-info .song-details { flex: 1; }
.current-song-info .song-title { font-weight: 600; }
.current-song-info .song-artist { color: var(--text-muted); font-size: 0.85rem; }
.listener-count { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.listener-count .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.create-station { max-width: 500px; margin: 0 auto; padding-top: 2rem; }
.create-station h2 { margin-bottom: 2rem; }
.create-form, .drive-setup, .folder-select { display: flex; flex-direction: column; gap: 1rem; }


.player-filters { margin-bottom: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.genre-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.genre-btn { padding: 0.4rem 1rem; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.genre-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.genre-btn:hover { border-color: var(--primary); color: var(--text); }
.stations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }

.station-card { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; transition: transform 0.2s; }
.station-card:hover { transform: translateY(-2px); }
.station-card-image { height: 140px; overflow: hidden; }
.station-card-image img { width: 100%; height: 100%; object-fit: cover; }
.station-card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--primary); font-size: 2.5rem; font-weight: 700; color: #fff; }
.station-card-body { padding: 1rem; }
.station-card-body h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.station-card-owner { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.station-card-genre { display: inline-block; background: var(--bg-input); padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; color: var(--text-muted); }
.station-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.8rem; }

.live-badge { background: var(--danger); color: #fff; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.station-info-header { display: flex; gap: 2rem; margin-bottom: 2rem; }
.station-art, .station-art-placeholder { width: 200px; height: 200px; border-radius: 12px; object-fit: cover; }
.station-art-placeholder { display: flex; align-items: center; justify-content: center; background: var(--primary); font-size: 4rem; font-weight: 700; color: #fff; }
.station-info-meta { display: flex; flex-direction: column; gap: 0.5rem; }
.station-info-meta h2 { font-size: 1.8rem; }
.station-owner { color: var(--text-muted); }
.station-description { color: var(--text-muted); margin-top: 0.5rem; line-height: 1.6; }

.audio-player { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.player-info { display: flex; flex-direction: column; gap: 0.3rem; }
.player-info span { color: var(--text-muted); font-size: 0.85rem; }
.player-controls { display: flex; align-items: center; gap: 1rem; }
.player-btn { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.player-btn:hover { background: var(--primary-hover); }
.volume-slider { width: 100px; accent-color: var(--primary); }

.image-upload { width: 200px; height: 200px; border: 2px dashed var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; transition: border-color 0.2s; }
.image-upload:hover, .image-upload.dragging { border-color: var(--primary); }
.image-upload img { width: 100%; height: 100%; object-fit: cover; }
.image-upload-placeholder { text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 1rem; }

.toast { position: fixed; top: 1rem; right: 1rem; padding: 0.8rem 1.5rem; border-radius: 8px; color: #fff; font-weight: 600; z-index: 1000; animation: fadeIn 0.3s; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.loading, .dashboard-empty, .error { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.dashboard-empty { display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.hidden { display: none !important; }

.dashboard { display: flex; flex-direction: column; gap: 1.5rem; }
.dashboard-header-card { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border); padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; }
.dashboard-header-left { display: flex; align-items: center; gap: 1rem; }
.dashboard-station-name { font-size: 1.5rem; font-weight: 700; }
.dashboard-header-right { display: flex; align-items: center; gap: 1rem; }
.dashboard-card { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border); padding: 1.5rem 2rem; }
.dashboard-card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; font-weight: 600; font-size: 1rem; color: var(--text-muted); }
.dashboard-card-icon { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; font-size: 1rem; }
.dashboard-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

select, textarea, input:not([type=range]):not([type=file]):not([type=submit]) { background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 0.95rem; padding: 0.75rem 1rem; width: 100%; appearance: none; -webkit-appearance: none; -moz-appearance: none; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; cursor: pointer; }
select:focus, textarea:focus, input:not([type=range]):not([type=file]):not([type=submit]):focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.15); }
option { background: var(--bg-card); color: var(--text); padding: 0.5rem; }

.status-badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.status-badge-live { background: rgba(46,204,113,0.15); color: var(--success); }
.status-badge-offline { background: rgba(136,136,160,0.15); color: var(--text-muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot-live { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot-offline { background: var(--text-muted); }
.now-playing-row { display: flex; align-items: center; gap: 1.5rem; padding: 0.5rem 0; }
.now-playing-icon { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #a855f7); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; flex-shrink: 0; }
.now-playing-info { flex: 1; min-width: 0; }
.now-playing-title { font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-playing-artist { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-playing-listeners { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.now-playing-empty { display: flex; align-items: center; gap: 0.6rem; color: var(--text-muted); padding: 0.5rem 0; }
.control-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stream-url-display { background: var(--bg-input); border-radius: 10px; padding: 0.8rem 1rem; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; word-break: break-all; margin-bottom: 1rem; border: 1px solid var(--border); }
.stream-url-display code { color: var(--primary); }
.song-order-row { display: flex; gap: 0.5rem; align-items: center; }
.drive-status { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.drive-connected { display: flex; align-items: center; gap: 0.5rem; color: var(--success); font-weight: 500; }
.drive-not-connected { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }
.folder-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; padding: 0.75rem; background: var(--bg-input); border-radius: 10px; border: 1px solid var(--border); }
.folder-name { flex: 1; font-size: 0.9rem; }
.folder-select-row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.danger-zone { border-color: rgba(231,76,60,0.3); }
.danger-zone .dashboard-card-header { color: var(--danger); }
.danger-zone-text { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.5; }

.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 999; backdrop-filter: blur(2px); }
.confirm-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; max-width: 400px; width: 90%; text-align: center; box-shadow: 0 25px 60px rgba(0,0,0,0.5); }
.confirm-box h3 { margin-bottom: 0.5rem; font-size: 1.15rem; }
.confirm-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.5; }
.confirm-actions { display: flex; gap: 0.75rem; justify-content: center; }

.settings-modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 480px; box-shadow: 0 25px 60px rgba(0,0,0,0.5); }
.settings-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 1.75rem; border-bottom: 1px solid var(--border); }
.settings-modal-header h3 { font-size: 1.15rem; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: all 0.15s; flex-shrink: 0; }
.modal-close:hover { background: var(--bg-input); color: var(--text); }
.settings-modal-body { padding: 1.75rem; display: flex; flex-direction: column; gap: 1.5rem; }
.settings-modal-footer { padding: 1.25rem 1.75rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }

@media (max-width: 768px) {
  .navbar { flex-direction: column; gap: 1rem; }
  .navbar-links { flex-wrap: wrap; justify-content: center; }
  .station-info-header { flex-direction: column; align-items: center; text-align: center; }
  .audio-player { flex-direction: column; text-align: center; }
  .hero h1 { font-size: 2rem; }
}
