:root {
  --bg-primary: #f9f9f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f8f8;
  --bg-hover: #e8e8e8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-tertiary: #999;
  --text-muted: #777;
  --border-color: #ddd;
  --border-light: #eee;
  --shadow: rgba(0,0,0,0.1);
  --accent: #2196F3;
  --accent-hover: #1976D2;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #252525;
  --bg-hover: #3a3a3a;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-tertiary: #808080;
  --text-muted: #999;
  --border-color: #444;
  --border-light: #333;
  --shadow: rgba(0,0,0,0.3);
  --accent: #42a5f5;
  --accent-hover: #1e88e5;
}

body { 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
  max-width: 100%; 
  margin: 0; 
  padding: 15px; 
  line-height: 1.6; 
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}
.container {
  max-width: 800px;
  margin: 0 auto;
}
h1 { font-size: 1.8rem; text-align: center; margin-bottom: 5px; }
h2 { text-align: center; margin-top: 0; color: var(--text-secondary); font-size: 1.1rem; }

.header-container {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 10px;
  width: 100%;
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  padding: 8px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px var(--shadow);
  width: 44px;
  height: 44px;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

#theme-icon {
  pointer-events: none;
}

.card { 
  background-color: var(--bg-secondary); 
  padding: 15px; 
  border-radius: 8px; 
  box-shadow: 0 2px 5px var(--shadow);
  margin-bottom: 20px;
  transition: background-color 0.3s ease;
}

.current-program { 
  border-left: 5px solid #2196F3; 
}

.program-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 8px;
}
.badge-rogues { background-color: #ff6b6b; color: white; }
.badge-daytime { background-color: #4ecdc4; color: white; }

.now-playing-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 10px 0;
}

.now-playing-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.now-playing-layout > div {
  flex: 1;
  min-width: 0;
}

.album-art {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.listeners {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

audio {
  display: none;
}

.player-container {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
}

.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background-color: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.play-btn:hover {
  background-color: var(--accent-hover);
}

.player-label {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.playlist {
  margin-top: 15px;
  border-top: 1px solid var(--border-light);
  padding-top: 15px;
}

.playlist-header {
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
  -webkit-appearance: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  border: none;
  width: 100%;
  box-sizing: border-box;
}

.playlist-header:hover {
  background-color: var(--bg-hover);
}

.playlist-header:active {
  background-color: var(--bg-hover);
  transform: translateY(1px);
}

.playlist-header:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#playlist-drawer {
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.playlist-content {
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  transition: background-color 0.3s ease;
}

.playlist-message {
  margin-top: 15px;
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
  transition: background-color 0.3s ease;
}

.recent-tracks {
  max-height: 400px;
  overflow-y: auto;
}

.track-item {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.track-item:last-child {
  border-bottom: none;
}

.track-time {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.track-program {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-style: italic;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 15px;
}

.stat-box {
  text-align: center;
  padding: 15px;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  transition: background-color 0.3s ease;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.schedule-table { 
  width: 100%; 
  border-collapse: collapse; 
  margin-top: 15px;
  font-size: 0.9rem;
}
.schedule-table th, .schedule-table td { 
  border: 1px solid var(--border-color); 
  padding: 12px 8px; 
  text-align: left; 
}
.schedule-table th { 
  background-color: var(--bg-tertiary); 
  transition: background-color 0.3s ease;
}

.btn {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: var(--accent-hover);
}

.footer { 
  text-align: center; 
  font-size: 0.8rem; 
  color: var(--text-muted); 
  margin-top: 30px; 
}

/* Drawer Styles */
.drawer-container {
  display: flex;
  flex-direction: column;
}

.drawer-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  font-size: 1rem;
  text-align: left;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px var(--shadow);
  color: var(--text-primary);
  font-family: inherit;
  display: flex;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.drawer-toggle:hover {
  background: var(--bg-hover);
  box-shadow: 0 4px 8px var(--shadow);
}

.drawer-toggle:active {
  background: var(--bg-hover);
  transform: translateY(1px);
}

.drawer-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drawer-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
  min-width: 16px;
}

.drawer-toggle[aria-expanded="true"] .drawer-icon {
  transform: rotate(-180deg);
}

.drawer-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 16px;
  box-shadow: 0 2px 5px var(--shadow);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Index page styles */
.stream-selector {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 40px;
}

.stream-card {
  display: block;
  padding: 20px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  text-align: center;
  background: var(--card-bg, var(--bg-secondary));
  position: relative;
  box-shadow: 0 4px 12px var(--shadow);
}

.stream-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(33, 150, 243, 0.3);
  background: var(--card-hover-bg, var(--bg-secondary));
}

.stream-card h2 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
  color: var(--accent);
}

.stream-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.stream-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

.stream-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--accent);
  justify-content: center;
  flex-wrap: wrap;
}

.index-play-btn, .nav-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 100px;
}

.index-play-btn {
  background: var(--accent);
  color: white;
}

.index-play-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.index-play-btn.playing {
  background: #ff4444;
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.nav-btn:hover {
  background: var(--accent);
  color: white;
}

.player-bar {
  background: var(--card-bg, var(--bg-secondary));
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stop-btn {
  background: #ff4444;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.stop-btn:hover {
  opacity: 0.9;
}

.player-info {
  flex: 1;
}

.player-info div {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

@media (max-width: 599px) {
  .stream-selector {
    gap: 16px;
    margin-top: 20px;
  }

  .stream-card {
    box-shadow: 0 4px 16px var(--shadow);
    border-width: 2px;
  }
}

@media (min-width: 600px) {
  .stream-selector {
    flex-direction: row;
    gap: 20px;
  }

  .stream-card {
    flex: 1;
  }
}

[data-theme="dark"] .stream-card:hover {
  box-shadow: 0 8px 16px rgba(33, 150, 243, 0.2);
}
