/* ============================================================
   Hörspiel Player — Dark Theme CSS
   ============================================================ */

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-2: #252540;
  --surface-3: #2e2e50;
  --accent: #075d00;
  --accent-hover: #5ba055;
  --accent-light: #47e541;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #2e2e50;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: 150ms ease;
  --player-height: 96px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img { display: block; max-width: 100%; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Layout ---- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.app-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.app-title span {
  color: var(--accent-light);
}

nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover, .nav-link.active {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

/* ---- Main Content ---- */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  padding-bottom: calc(var(--player-height) + 1.5rem);
}

/* ---- Hidden utility ---- */
.hidden { display: none !important; }

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumb-sep {
  color: var(--text-dim);
  font-size: 0.875rem;
}

.breadcrumb-current {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Search & Filter Bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--accent); }

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tag-chip:hover { border-color: var(--accent); color: var(--accent-light); }
.tag-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}

/* ---- Card Grid ---- */
.hoerspiele-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.card-cover {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.card:hover .card-cover img { transform: scale(1.04); }

.card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.card-cover-placeholder.letter {
  font-size: 3rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
}

.card-cover-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.card-body {
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.card-tag {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.375rem;
}

.card-episode-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---- Episode Cards List ---- */
.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.episode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.episode-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.episode-card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.episode-card-cover {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}

.episode-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.episode-card-info {
  flex: 1;
  min-width: 0;
}

.episode-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

/* Episode progress bar at the bottom of card */
.episode-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.episode-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.episode-card-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

/* ---- Download Button ---- */
.download-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  padding: 0;
  position: relative;
}

.download-btn:hover { background: var(--surface-2); color: var(--text); }
.download-btn.downloaded { color: var(--success); }
.download-btn.downloading { color: var(--accent-light); }
.download-btn.error { color: var(--danger); }

.download-progress-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--progress, 0%), transparent 0%);
  opacity: 0.25;
  pointer-events: none;
}

/* ---- Playing Indicator ---- */
.playing-indicator {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(124, 58, 237, 0.9);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: white;
  display: none;
}

.card.playing .playing-indicator { display: block; }

/* ---- Empty State ---- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.card-skeleton .card-cover { background: var(--surface-2); }
.card-skeleton .card-cover .skeleton { width: 100%; height: 100%; border-radius: 0; }
.card-skeleton .skeleton-title { height: 14px; width: 80%; margin-bottom: 6px; }
.card-skeleton .skeleton-tag { height: 12px; width: 50%; }

/* ---- Player Bar ---- */
#player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--player-height);
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#player-bar.visible { transform: translateY(0); }

.player-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 260px;
}

.player-cover {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}

.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.player-text {
  min-width: 0;
}

.player-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-info {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Player Controls ---- */
.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  padding: 0;
}

.player-btn:hover { background: var(--surface-2); color: var(--text); }
.player-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.player-btn.play-pause {
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: white;
}

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

.player-progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-display {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Range Input (Seek / Volume) ---- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  outline: none;
  cursor: pointer;
  flex: 1;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.player-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-width: 100px;
}

.player-volume input[type="range"] { width: 80px; }

.volume-icon { color: var(--text-dim); flex-shrink: 0; }

/* ---- Toast / Notifications ---- */
#toast-container {
  position: fixed;
  bottom: calc(var(--player-height) + 1rem);
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 200ms ease;
  max-width: 300px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   Admin Panel Styles
   ============================================================ */

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ---- Admin Tabs ---- */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.admin-tab {
  padding: 0.625rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.admin-tab-panel {
  /* visible by default; use .hidden to hide */
}

/* ---- Import Section ---- */
.import-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* Folder Breadcrumb */
.folder-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.folder-crumb {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}

.folder-crumb:hover { background: var(--surface-2); }
.folder-crumb.active { color: var(--text); cursor: default; }

.folder-crumb-sep {
  color: var(--text-dim);
  font-size: 0.75rem;
  user-select: none;
}

/* Folder Browser */
.folder-browser {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.folder-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.folder-item:last-child { border-bottom: none; }
.folder-item:hover { background: var(--surface-2); color: var(--text); }
.folder-item.selected { background: rgba(124, 58, 237, 0.15); color: var(--accent-light); border-color: rgba(124,58,237,0.2); }

.folder-item-icon { font-size: 1rem; flex-shrink: 0; }

.folder-item-name { flex: 1; font-weight: 500; }

.folder-item-meta { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }

.mp3-file-item {
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Import Result */
.import-result {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.import-result.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--surface-3); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm {
  padding: 0.3rem 0.625rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ---- Admin Table ---- */
.admin-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--surface-2); }

.table-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  object-fit: cover;
  flex-shrink: 0;
}

.table-cover-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(255,255,255,0.5);
}

.table-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.table-tag {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  background: var(--surface-3);
  border-radius: 999px;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-actions { display: flex; gap: 0.375rem; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 150ms ease;
}

.modal-backdrop.hidden { display: none; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modal-in 200ms ease;
}

.modal-lg { max-width: 720px; }

@keyframes modal-in {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body {
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ---- Form ---- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-dim); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus { border-color: var(--accent); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select option { background: var(--surface); }

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

/* ---- Tag Input ---- */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  align-items: center;
  cursor: text;
  transition: border-color var(--transition);
}

.tag-input-wrapper:focus-within { border-color: var(--accent); }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.8rem;
  color: white;
}

.tag-pill-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  line-height: 1;
}

.tag-pill-remove:hover { color: white; }

.tag-text-input {
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: 0.125rem 0.25rem;
  font-size: 0.875rem;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.tag-suggestion {
  font-size: 0.75rem;
  padding: 0.2rem 0.625rem;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.tag-suggestion:hover { border-color: var(--accent); color: var(--accent-light); }

/* ---- Cover Upload ---- */
.cover-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.cover-upload-area:hover, .cover-upload-area.dragover {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.05);
}

.cover-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.cover-preview {
  margin-top: 0.75rem;
  display: none;
}

.cover-preview img {
  max-width: 120px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin: 0 auto;
  object-fit: cover;
}

.cover-preview.visible { display: block; }

/* ---- File / Folder Browser ---- */
.file-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--surface-2); color: var(--text); }
.file-item.selected { background: rgba(124, 58, 237, 0.15); color: var(--accent-light); }

.file-item svg { flex-shrink: 0; }

.file-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ---- Confirm Dialog ---- */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.confirm-backdrop.hidden { display: none; }

.confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
}

.confirm-dialog h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.confirm-dialog p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ---- Status Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-purple { background: rgba(124, 58, 237, 0.2); color: var(--accent-light); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .header-inner { gap: 0.75rem; }
  .app-title { font-size: 1rem; }

  .hoerspiele-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .player-info { max-width: 140px; }
  .player-volume { display: none; }

  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) { display: none; }

  .episode-card-cover { width: 56px; height: 56px; }
}

@media (max-width: 480px) {
  .hoerspiele-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-bar { gap: 0.5rem; }
  .search-wrapper { max-width: 100%; }

  .admin-tabs { overflow-x: auto; }
  .admin-tab { font-size: 0.8rem; padding: 0.5rem 0.875rem; }
}

/* ============================================================
   Cover Picker (import modal)
   ============================================================ */
.cover-picker-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}

.cover-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.cover-picker-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.cover-picker-item:hover { border-color: var(--accent-light); }
.cover-picker-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.cover-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-picker-item.none-option {
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-direction: column;
  gap: 0.25rem;
}
.cover-picker-item .cp-checkmark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
}
.cover-picker-item.selected .cp-checkmark { display: flex; }

.cover-picker-episode {
  margin-bottom: 0.875rem;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.cover-picker-episode-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Episode card — Play button overlay
   ============================================================ */
.episode-card-cover { position: relative; flex-shrink: 0; }

.episode-play-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: background var(--transition), transform var(--transition);
  z-index: 2;
}
.episode-play-btn:hover { background: var(--accent-hover); transform: scale(1.1); }
.episode-play-btn svg { pointer-events: none; }

/* Make card clickable as "open tracks" */
.episode-card { cursor: pointer; }
.episode-card-info { cursor: pointer; }

/* ============================================================
   Track List View (View 3)
   ============================================================ */
.track-view-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.5rem 1.5rem;
  max-width: 900px;
}

.track-view-cover {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.track-view-cover img { width: 100%; height: 100%; object-fit: cover; }
.track-view-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-light);
}

.track-view-meta { flex: 1; min-width: 0; }
.track-view-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-view-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.track-view-play-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.track-view-play-all:hover { background: var(--accent-hover); }

.track-list {
  max-width: 900px;
  padding: 0 1rem 2rem;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.track-item:last-child { border-bottom: none; }
.track-item:hover { background: var(--surface-2); }
.track-item.playing {
  background: var(--surface-2);
  color: var(--accent-light);
}

.track-num {
  width: 28px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.track-item.playing .track-num { color: var(--accent); }

.track-item-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.track-item:hover .track-item-play,
.track-item.playing .track-item-play {
  color: var(--accent-light);
  background: var(--surface-3);
}

.track-name {
  flex: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-item.playing .track-name { font-weight: 600; color: var(--accent-light); }

.track-duration {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ============================================================
   Playlist Panel (bottom sheet)
   ============================================================ */
.playlist-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.playlist-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--player-height);
  z-index: 201;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.playlist-panel.open { transform: translateY(0); }

.playlist-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.playlist-panel-title { font-weight: 600; font-size: 0.95rem; }

.playlist-episode-info {
  padding: 0.5rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.playlist-tracks {
  overflow-y: auto;
  flex: 1;
}

.playlist-track-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.playlist-track-item:last-child { border-bottom: none; }
.playlist-track-item:hover { background: var(--surface-2); }
.playlist-track-item.active {
  background: var(--surface-2);
  color: var(--accent-light);
}

.playlist-track-num {
  width: 24px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.playlist-track-item.active .playlist-track-num { color: var(--accent); }

.playlist-track-playing-icon {
  width: 16px;
  flex-shrink: 0;
  color: var(--accent);
}
.playlist-track-item:not(.active) .playlist-track-playing-icon { visibility: hidden; }

.playlist-track-name {
  flex: 1;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-track-item.active .playlist-track-name { font-weight: 600; }

.playlist-track-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Playlist button active state */
.btn-playlist.active { color: var(--accent-light); }

@media (max-width: 600px) {
  .track-view-header { padding: 0.75rem 1rem 1rem; }
  .track-view-cover { width: 72px; height: 72px; }
  .track-view-title { font-size: 1rem; }
  .playlist-panel { max-height: 65vh; }
}

/* ============================================================
   Login Overlay
   ============================================================ */
.login-overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 360px;
  text-align: center; box-shadow: var(--shadow);
}
.login-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.login-box h2 { margin-bottom: 0.25rem; }
.login-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.25rem; }
.login-error { background: rgba(239,68,68,0.15); color: var(--danger); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; font-size: 0.875rem; }
.login-box .form-input { text-align: center; font-size: 1rem; letter-spacing: 0.1em; }

/* ============================================================
   Feature: Seek Slider Visual Fill (Feature 3)
   ============================================================ */
#seek-slider {
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--seek-pct, 0%),
    var(--surface-3) var(--seek-pct, 0%),
    var(--surface-3) 100%
  );
}

/* ============================================================
   Feature: Cover Lightbox (Feature 2)
   ============================================================ */
.cover-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fade-in 150ms ease;
}

.cover-lightbox.hidden { display: none; }

.cover-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 64px rgba(0, 0, 0, 0.8);
  object-fit: contain;
  cursor: default;
}

.cover-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}

.cover-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

/* ============================================================
   Feature: Series View Toggle (Feature 4)
   ============================================================ */
.view-toggle {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.view-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 0;
}

.view-btn:hover { background: var(--surface-2); color: var(--text); }
.view-btn.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); }

/* Series List View */
.hoerspiele-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.series-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.series-list-item:hover { border-color: var(--accent); background: var(--surface-2); }
.series-list-item.playing { border-color: var(--accent); }

.series-list-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}

.series-list-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.series-list-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.series-list-info { flex: 1; min-width: 0; }

.series-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.series-list-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.series-list-tags { display: flex; gap: 0.25rem; flex-wrap: wrap; }
