@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap");

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #ececec;
  --border-strong: #e0e0e0;
  --text: #171717;
  --muted: #6f6f76;
  --faint: #a1a1a8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-border: #d3e0fd;
  --grad: linear-gradient(135deg, #2563eb, #3b82f6);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --hover: #f2f2f2;
  --dropzone-bg: #fcfcfc;
  --tag-bg: #f4f4f4;
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --glow-1: #f1f1f1;
  --glow-2: #ededed;
  --toast-bg: #171717;
  --radius: 14px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

html.dark {
  --bg: #0a0a0b;
  --surface: #141416;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f5;
  --muted: #a1a1a6;
  --faint: #6e6e74;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-border: rgba(59, 130, 246, 0.35);
  --grad: linear-gradient(135deg, #2563eb, #60a5fa);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #34d399;
  --hover: rgba(255, 255, 255, 0.07);
  --dropzone-bg: rgba(255, 255, 255, 0.02);
  --tag-bg: rgba(255, 255, 255, 0.06);
  --topbar-bg: rgba(10, 10, 11, 0.8);
  --glow-1: rgba(255, 255, 255, 0.05);
  --glow-2: rgba(255, 255, 255, 0.03);
  --toast-bg: #232326;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .tab, .btn {
  font-family: "Plus Jakarta Sans", "Inter", sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.error-text { color: var(--danger); margin-top: 10px; font-size: 0.88rem; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  color: var(--text);
  background: var(--surface);
}
.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #2f74f0, #1d4ed8);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { border-color: var(--faint); background: var(--hover); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- inputs ---------- */
input[type="text"], select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
input[type="text"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
input::placeholder { color: var(--faint); }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 400px at 15% 0%, var(--glow-1) 0%, transparent 60%),
    radial-gradient(700px 400px at 90% 100%, var(--glow-2) 0%, transparent 60%),
    var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: rise 0.4s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 18px 0 4px;
  color: var(--text);
}
.login-card > .muted { font-size: 0.92rem; }
.login-card form { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.login-card .small { margin-top: 12px; color: var(--faint); }
.login-card #guest-upload-btn { margin-top: 26px; padding: 13px 20px; font-size: 1rem; }
.login-card #guest-upload-btn + .small { margin-top: 8px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 26px 0 6px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.logo-img {
  display: block;
  margin: 0 auto;
  width: 210px;
  height: auto;
}
html.dark .logo-img { filter: invert(1); }
.small-logo {
  display: inline-block;
  width: auto;
  height: 40px;
  margin: 0;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab.active { background: var(--accent-soft); color: var(--accent); }

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  border: 1px solid var(--accent-border);
}

/* ---------- layout ---------- */
main { max-width: 1060px; margin: 0 auto; padding: 40px 24px 80px; }
.tab-panel { animation: fade 0.25s ease both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.panel-head h2 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.panel-head .small { margin-top: 5px; max-width: 540px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 128px; font-size: 0.86rem; padding: 8px 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.card h3 { margin-bottom: 6px; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- forms ---------- */
.form-card { max-width: 800px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.form-row .form-field { flex: 1; min-width: 160px; }
.form-row.align-end { align-items: flex-end; }
.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: var(--dropzone-bg);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone p { pointer-events: none; font-size: 0.95rem; }
.dropzone .small { margin-top: 7px; color: var(--faint); }

/* ---------- library ---------- */
.library-list { display: flex; flex-direction: column; gap: 12px; }
.track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.track-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.track-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.track-title { font-weight: 700; font-size: 1rem; flex: 1; min-width: 200px; letter-spacing: -0.01em; }
.track-title .muted { font-weight: 400; font-size: 0.78rem; display: block; margin-top: 3px; }
.tag {
  display: inline-block;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 12px;
  white-space: nowrap;
}
.tag.accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 700;
}
.track-actions { display: flex; gap: 6px; }
.track-card audio {
  width: 100%;
  margin-top: 14px;
  height: 38px;
}

/* ---------- users table ---------- */
.user-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.user-table th, .user-table td { text-align: left; padding: 11px 12px; font-size: 0.88rem; }
.user-table th {
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-strong);
}
.user-table td { border-bottom: 1px solid var(--border); }
.user-table tr:last-child td { border-bottom: none; }
.user-table code {
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 0.84rem;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 13px 22px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 100;
  max-width: 90vw;
  animation: rise 0.25s ease both;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ---------- theme toggle ---------- */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 50;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

body,
.card, .track-card, .login-card, .topbar,
input[type="text"], select, .btn-ghost, .tag, .dropzone {
  transition-property: background, background-color, color, border-color;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* ---------- footer ---------- */
.site-footer {
  text-align: center;
  color: var(--faint);
  font-size: 0.78rem;
  padding: 24px 20px 34px;
}

@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 11px 16px; }
  .tabs { order: 3; width: 100%; }
  .brand { font-size: 0.9rem; }
  main { padding: 26px 16px 64px; }
  .login-card { padding: 36px 26px 30px; }
}
