/* ============================================
   PESNIČKY — Zbor Zuberec
   Štýl prebraný z MRH Uploadera (card layout, soft radius, zelený akcent)
   ============================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --fg: #0f0f0f;
  --muted: #6b7280;
  --line: #e6e8ec;
  --line-strong: #0f0f0f;
  --hover-bg: rgba(0,0,0,0.04);
  --drag-bg: #f3f4f6;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --accent-soft: rgba(34,197,94,0.08);
  --danger: #e11d48;
  --toast-bg: rgba(15,15,15,0.96);
  --toast-fg: #fff;
}

:root[data-theme="dark"] {
  --bg: #050505;
  --surface: #141414;
  --fg: #ffffff;
  --muted: #c7c7c7;
  --line: #2a2a2a;
  --line-strong: #ffffff;
  --hover-bg: rgba(255,255,255,0.07);
  --drag-bg: #1d1d1d;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --accent-soft: rgba(34,197,94,0.12);
  --danger: #ff6b6b;
}

html, body {
  margin: 0; padding: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

body {
  min-height: 100vh;
  padding: 42px 32px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================================
   HEADER
   ============================================ */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.brand {
  font-size: 18px;
  font-weight: 600;
}
.brand .mode {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 10px;
}

header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}
.theme-toggle:hover { background: var(--hover-bg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================
   UPLOAD PANEL (collapsible)
   ============================================ */
.upload-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
  margin-bottom: 0;
}
.upload-panel.open {
  max-height: 900px;
  opacity: 1;
  margin-bottom: 32px;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 22px;
  padding: 60px 24px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 20px;
  transition: 0.2s;
  cursor: pointer;
}
.dropzone:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.dropzone.drag {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-label {
  font-size: 22px;
  font-weight: 600;
}
.dropzone-hint {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}
.drop-filename {
  margin-top: 14px;
  font-size: 14px;
  color: var(--fg);
  font-weight: 500;
}

/* Upload fields */
.upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.form-input {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--muted); opacity: 0.7; }

.upload-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); background: var(--accent-strong); color: #fff; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
}
.btn-ghost:hover { background: var(--hover-bg); }

/* Progress */
.progress {
  display: none;
  margin-top: 18px;
  padding: 16px 0 4px;
}
.progress.active { display: block; }
.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.2s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

/* ============================================
   FILES HEADER
   ============================================ */
.files-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.files-title {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.files-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.files-count {
  font-size: 13px;
  color: var(--muted);
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.btn-add:hover { transform: translateY(-1px); }
.btn-add-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

/* ============================================
   SONG CARD
   ============================================ */
.file {
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: 0.2s;
}
.file:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}
.file.open {
  border-color: var(--accent);
}

.file-main {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.file-num {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.file.open .file-num { color: var(--accent-strong); font-weight: 600; }

.file-info { min-width: 0; }
.file-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name.unnamed {
  font-weight: 400;
  color: var(--muted);
  font-style: italic;
}
.file-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.file-dur {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.action {
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  transition: 0.15s;
}
.action:hover { color: var(--fg); background: var(--hover-bg); }
.action.danger:hover { color: var(--danger); }

/* Inline player */
.inline-player {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, margin 0.2s ease;
}
.file.open .inline-player {
  max-height: 80px;
  margin-top: 14px;
}
.ip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ip-btn {
  background: transparent;
  border: none;
  color: var(--fg);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: 0.15s;
}
.ip-btn:hover { background: var(--hover-bg); }
.ip-play {
  background: var(--accent);
  color: #fff;
  width: 36px; height: 36px;
}
.ip-play:hover { background: var(--accent-strong); }
.ip-time {
  font-size: 12px;
  color: var(--muted);
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}
.ip-time-r { text-align: right; }

/* Range */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 20px;
  background: transparent;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
}
input[type=range]::-moz-range-track {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5px;
  transition: transform 0.15s;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  transition: transform 0.15s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.2); }
input[type=range]:hover::-moz-range-thumb { transform: scale(1.2); }

.ip-vol {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}
.ip-vol .vol-range { flex: 0 0 70px !important; }
.vol-label {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   STATES
   ============================================ */
.loading, .empty {
  padding: 60px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

/* ============================================
   SONG DETAIL
   ============================================ */
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: 0.15s;
}
.back-link:hover { color: var(--fg); }

.song-detail {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}
.detail-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.detail-meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.detail-player {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 24px;
}
.dp-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dp-play {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.15s;
}
.dp-play:hover { background: var(--accent-strong); transform: scale(1.05); }
.dp-play .icon-pause { display: none; }
.dp-play .icon-play { display: block; transform: translateX(2px); }
.dp-play.is-playing .icon-play { display: none; }
.dp-play.is-playing .icon-pause { display: block; transform: none; }

.dp-time {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}
.dp-time-r { text-align: right; }
.dp-seek { flex: 1; }

.dp-vol-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.dp-vol-label {
  font-size: 13px;
  color: var(--muted);
  min-width: 72px;
}
.dp-vol { flex: 1; max-width: 200px; }

.detail-actions { display: flex; gap: 12px; }

/* ============================================
   FOOTER
   ============================================ */
footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 60px;
  padding-bottom: 20px;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: 18px 26px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 9999;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 720px) {
  body { padding: 24px 16px; }
  header { padding: 14px 16px; margin-bottom: 24px; }
  .brand { font-size: 16px; }
  .brand .mode { display: block; margin-left: 0; margin-top: 2px; font-size: 12px; }

  .dropzone { padding: 40px 16px; }
  .dropzone-label { font-size: 18px; }

  .upload-fields { grid-template-columns: 1fr; }

  .file-main { grid-template-columns: 28px 1fr auto; gap: 12px; }
  .file-dur { display: none; }
  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
  }

  .ip-vol { display: none; }

  .song-detail { padding: 22px; }
  .detail-title { font-size: 22px; }
  .dp-vol-row { display: none; }
}
