/* ── RESET & ROOT ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #ffffff;
  --sidebar-bg:  #f7f7fb;
  --surface:     #f0f0f7;
  --surface2:    #e8e8f2;
  --surface3:    #dddde8;
  --border:      rgba(0,0,0,0.07);
  --border2:     rgba(0,0,0,0.12);
  --accent:      #A0C4FF;
  --accent-dim:  rgba(160,196,255,0.15);
  --accent-glow: rgba(160,196,255,0.3);
  --accent2:     #FFE497;
  --accent2-dim: rgba(255,228,151,0.2);
  --text:        #1a1830;
  --text2:       #5a5778;
  --muted:       #9896b0;
  --red:         #e05c5c;
  --yellow:      #d4970a;
  --green:       #2aad6e;

  --font:        'DM Sans', -apple-system, sans-serif;
  --mono:        'DM Mono', monospace;

  --sidebar-w:   248px;
  --topbar-h:    58px;
  --player-h:    78px;
  --mobnav-h:    60px;
  --radius:      10px;
  --radius-lg:   14px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── APP SHELL ─────────────────────────────────────────── */
.app {
  display: grid;
  height: 100dvh;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas:
    "sidebar main"
    "player  player";
  position: relative;
  overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
  font-family: var(--font);
}
.logo span { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px 4px;
  margin-bottom: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  position: relative;
}
.nav-item i { font-size: 17px; flex-shrink: 0; }
.nav-item span { flex: 1; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: #3a6ebf;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: #3a6ebf;
  border-radius: 0 3px 3px 0;
  margin-left: -10px;
}

.nav-badge {
  font-style: normal;
  font-size: 11px;
  background: var(--surface3);
  color: var(--text2);
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 500;
}
.nav-item.active .nav-badge {
  background: var(--accent-dim);
  color: #3a6ebf;
}

.cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.user-card:hover { background: var(--surface); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.user-role { display: block; font-size: 11px; color: var(--muted); }

/* ── MAIN ──────────────────────────────────────────────── */
.main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── TOPBAR ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 20;
}

.menu-btn { display: none; }

.search-bar {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 0 14px;
  height: 36px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: rgba(160,196,255,0.7); }
.search-bar i { color: var(--muted); font-size: 15px; flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: var(--font);
}
.search-bar input::placeholder { color: var(--muted); }
.search-bar kbd {
  background: var(--surface3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  display: inline-block;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

/* ── ICON BUTTONS ──────────────────────────────────────── */
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: #ffffff; color: var(--text); }

/* ── PAGE CONTENT SCROLL ───────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
  scroll-behavior: smooth;
}
.page-content::-webkit-scrollbar { width: 5px; }
.page-content::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ── SECTION WRAPPERS ──────────────────────────────────── */
.page-section { padding: 24px 28px 0; }
.page-section:last-child { padding-bottom: 24px; }

.section-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.section-more {
  font-size: 12px; font-weight: 500;
  color: #3a6ebf;
  cursor: pointer;
  background: none; border: none;
  transition: opacity 0.12s;
}
.section-more:hover { opacity: 0.75; }

/* ── HERO CARD ─────────────────────────────────────────── */
.hero-card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border2);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.2s;
}
.hero-card:hover { border-color: rgba(160,196,255,0.8); transform: translateY(-2px); }

.hero-thumb {
  width: 100%; aspect-ratio: 16/9;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.thumb-bg {
  position: absolute; inset: 0;
  transition: transform 0.4s;
}
.hero-card:hover .thumb-bg { transform: scale(1.02); }

.tb-hero {
  background:
    radial-gradient(ellipse at 25% 35%, rgba(124,110,242,0.3) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 70%, rgba(62,207,160,0.2) 0%, transparent 50%),
    linear-gradient(160deg, #e4e2f8 0%, #dce8f5 100%);
}

.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,110,242,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,110,242,0.06) 1px, transparent 1px);
  background-size: 44px 44px;
}

.play-center {
  position: relative; z-index: 2;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(160,196,255,0.9);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.hero-card:hover .play-center { transform: scale(1.1); background: var(--accent); color: #1a1830; }
.play-center i { font-size: 26px; color: #fff; margin-left: 3px; }

.thumb-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  font-size: 10px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase;
  background: rgba(160,196,255,0.92);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 4px 11px;
  border-radius: 20px;
}

.thumb-dur {
  position: absolute; bottom: 12px; right: 14px; z-index: 2;
  font-size: 12px; font-family: var(--mono);
  background: rgba(0,0,0,0.65);
  color: #fff;
  padding: 2px 8px;
  border-radius: 5px;
}

.hero-info { padding: 16px 20px 18px; }
.hero-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; margin-bottom: 8px; line-height: 1.3; }
.hero-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2);
}
.hero-meta i { font-size: 13px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

/* ── FILTER TABS ───────────────────────────────────────── */
.filter-tabs {
  display: flex; gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.ftab {
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border2);
  background: none;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font);
  transition: all 0.12s;
}
.ftab.active { background: var(--accent); border-color: var(--accent); color: #1a1830; }
.ftab:hover:not(.active) { background: var(--surface2); color: var(--text); border-color: var(--border2); }

/* ── CARD GRID ─────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.2s, background 0.15s;
}
.media-card:hover {
  border-color: var(--border2);
  transform: translateY(-3px);
  background: var(--surface2);
}

.card-thumb {
  width: 100%; aspect-ratio: 16/9;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* thumb color variants */
.tb-1 { background: radial-gradient(at 30% 40%, rgba(124,110,242,0.5) 0%, #ddddf5 70%); }
.tb-2 { background: radial-gradient(at 70% 30%, rgba(62,207,160,0.5) 0%, #d5f0e8 70%); }
.tb-3 { background: radial-gradient(at 50% 60%, rgba(226,92,92,0.45) 0%, #f5dddd 70%); }
.tb-4 { background: radial-gradient(at 40% 40%, rgba(226,184,74,0.5) 0%, #f5f0d8 70%); }
.tb-5 { background: radial-gradient(at 60% 50%, rgba(74,160,226,0.5) 0%, #d8eaf5 70%); }
.tb-6 { background: radial-gradient(at 35% 55%, rgba(190,62,207,0.45) 0%, #eeddf5 70%); }
.tb-7 { background: radial-gradient(at 55% 35%, rgba(62,207,160,0.4) 0%, #d5f0e8 70%); }
.tb-8 { background: radial-gradient(at 45% 60%, rgba(242,168,110,0.5) 0%, #f5ead8 70%); }

.card-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.media-card:hover .card-overlay { background: rgba(0,0,0,0.38); }

.card-play {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(160,196,255,0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.75);
  transition: opacity 0.15s, transform 0.15s;
}
.media-card:hover .card-play { opacity: 1; transform: scale(1); }
.card-play i { font-size: 18px; color: #fff; margin-left: 2px; }

.type-tag {
  position: absolute; top: 9px; left: 9px; z-index: 2;
  font-size: 9px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 12px;
}
.tag-video { background: rgba(160,196,255,0.9); color: #1a1830; }
.tag-audio { background: rgba(255,228,151,0.9); color: #1a1830; }

.card-dur-tag {
  position: absolute; bottom: 8px; right: 9px; z-index: 2;
  font-size: 10px; font-family: var(--mono);
  background: rgba(0,0,0,0.65);
  color: #fff; padding: 1px 6px; border-radius: 4px;
}

.card-info { padding: 11px 13px 13px; }
.card-title {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 11px; color: var(--text2); display: flex; gap: 8px; align-items: center; }
.card-meta i { font-size: 12px; }

/* ── AUDIO LIST ────────────────────────────────────────── */
.audio-list { display: flex; flex-direction: column; gap: 2px; }

.audio-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.audio-row:hover { background: var(--surface); border-color: var(--border); }
.audio-row.playing {
  background: var(--accent-dim);
  border-color: rgba(124,110,242,0.2);
}

.audio-num {
  width: 22px; text-align: center;
  font-size: 12px; color: var(--muted); font-family: var(--mono);
  flex-shrink: 0;
}
.audio-row.playing .audio-num { color: var(--accent); }

.audio-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.aicon-green { background: var(--accent2-dim); color: #b8940a; }
.aicon-purple { background: var(--accent-dim); color: #3a6ebf; }

.audio-details { flex: 1; min-width: 0; }
.audio-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-row.playing .audio-name { color: var(--accent); }
.audio-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.audio-dur { font-size: 11.5px; color: var(--text2); font-family: var(--mono); flex-shrink: 0; }

.audio-more {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none;
  color: var(--muted); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.12s, background 0.12s;
}
.audio-row:hover .audio-more { opacity: 1; }
.audio-more:hover { background: var(--surface3); color: var(--text); }

/* Waveform animation */
.waveform { display: flex; align-items: center; gap: 2px; height: 14px; }
.waveform span {
  width: 2.5px; border-radius: 2px;
  background: var(--accent);
  animation: wavebar 0.7s ease-in-out infinite alternate;
}
.waveform span:nth-child(1) { height: 4px; animation-delay: 0s; }
.waveform span:nth-child(2) { height: 11px; animation-delay: 0.1s; }
.waveform span:nth-child(3) { height: 7px; animation-delay: 0.2s; }
.waveform span:nth-child(4) { height: 13px; animation-delay: 0.05s; }
.waveform span:nth-child(5) { height: 5px; animation-delay: 0.15s; }
@keyframes wavebar {
  from { transform: scaleY(1); }
  to   { transform: scaleY(0.25); }
}

/* ── PLAYER BAR ────────────────────────────────────────── */
.player {
  grid-area: player;
  height: var(--player-h);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 40;
}

.now-playing {
  display: flex; align-items: center; gap: 11px;
  flex: 1; min-width: 0;
}

.np-art {
  width: 44px; height: 44px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent);
  position: relative; overflow: hidden; flex-shrink: 0;
}
.np-art-glow {
  position: absolute; inset: 0;
  background: radial-gradient(at 40% 40%, rgba(124,110,242,0.25) 0%, transparent 70%);
}
.np-art i { position: relative; z-index: 1; }

.np-meta { flex: 1; min-width: 0; }
.np-title { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { display: block; font-size: 11px; color: var(--text2); margin-top: 1px; }

.np-like { color: var(--text2); }
.np-like:hover { color: var(--red) !important; }
.np-like.liked { color: var(--red) !important; }

.player-center {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  flex: 2; max-width: 500px;
}

.ctrl-row { display: flex; align-items: center; gap: 6px; }

.ctrl-btn {
  width: 32px; height: 32px;
  border-radius: 7px; border: none;
  background: none;
  color: var(--text2); font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
  font-family: var(--font);
}
.ctrl-btn:hover { background: var(--surface2); color: var(--text); }
.ctrl-btn.on { color: #3a6ebf; }

.ctrl-play {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent) !important;
  color: #1a1830 !important;
  font-size: 17px;
  transition: background 0.12s, transform 0.1s !important;
}
.ctrl-play:hover { background: #7aabf5 !important; transform: scale(1.06); }

.ctrl-play-lg { width: 56px !important; height: 56px !important; font-size: 24px !important; }

.progress-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.time-label { font-size: 11px; color: var(--muted); font-family: var(--mono); min-width: 34px; }
.time-label:last-child { text-align: right; }

.progress-track {
  flex: 1; height: 3px;
  background: var(--surface3);
  border-radius: 3px; cursor: pointer; position: relative;
  transition: height 0.12s;
}
.progress-track:hover { height: 5px; }

.progress-fill {
  height: 100%; background: #A0C4FF; border-radius: 3px;
  position: relative; pointer-events: none;
  transition: width 0.1s linear;
}
.progress-thumb {
  position: absolute; right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  opacity: 0; transition: opacity 0.12s;
}
.progress-track:hover .progress-thumb { opacity: 1; }

.player-right {
  display: flex; align-items: center; gap: 6px;
  flex: 1; justify-content: flex-end;
}
.vol-track {
  width: 80px; height: 3px;
  background: var(--surface3); border-radius: 3px; cursor: pointer;
  transition: height 0.12s;
}
.vol-track:hover { height: 5px; }
.vol-fill { height: 100%; background: #A0C4FF; border-radius: 3px; transition: width 0.1s; }

/* ── MOBILE BOTTOM NAV ─────────────────────────────────── */
.mobile-nav {
  display: none;
  grid-area: mobnav;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  padding: 6px 0 max(env(safe-area-inset-bottom), 6px);
  z-index: 40;
}

.mob-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 12px;
  background: none; border: none;
  color: var(--muted);
  font-size: 10px; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: color 0.12s;
}
.mob-btn i { font-size: 22px; display: block; }
.mob-btn.active { color: #3a6ebf; }
.mob-btn:hover { color: var(--text); }

/* ── SIDEBAR OVERLAY ───────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 25;
  backdrop-filter: blur(2px);
}

/* ── UPLOAD MODAL ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(30,26,60,0.55);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: min(520px, 92vw);
  padding: 24px;
  animation: slideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 600; }

.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone i { font-size: 40px; color: var(--accent); display: block; margin-bottom: 12px; }
.upload-zone p { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.upload-zone span { font-size: 12px; color: var(--text2); display: block; margin-bottom: 16px; }

.upload-btn {
  display: inline-block;
  padding: 8px 20px;
  background: var(--accent);
  color: #1a1830;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.12s;
}
.upload-btn:hover { background: #7aabf5; }

.upload-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.upload-file {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.upload-file i { font-size: 20px; flex-shrink: 0; }
.uf-video { color: var(--accent); }
.uf-audio { color: var(--accent2); }
.upload-file-name { flex: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-file-size { font-size: 11px; color: var(--text2); font-family: var(--mono); flex-shrink: 0; }
.uf-remove { color: var(--muted); }
.uf-remove:hover { color: var(--red) !important; background: rgba(224,92,92,0.1) !important; }

/* ── FULL PLAYER OVERLAY ───────────────────────────────── */
.full-player-backdrop {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #f0f0f8 0%, #ffffff 100%);
  z-index: 300;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 32px;
  animation: fadeIn 0.2s ease;
}
.fp-close {
  position: absolute; top: 20px; left: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: none;
  color: var(--text2); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.fp-close:hover { background: var(--surface3); color: var(--text); }
.fp-art {
  margin-bottom: 32px;
}
.fp-art-inner {
  width: min(280px, 70vw); aspect-ratio: 1;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.fp-art-glow {
  position: absolute; inset: 0;
  background: radial-gradient(at 40% 35%, rgba(124,110,242,0.3) 0%, transparent 65%);
}
.fp-art-icon { font-size: 80px; color: #3a6ebf; position: relative; z-index: 1; }
.fp-meta { text-align: center; margin-bottom: 32px; }
.fp-title { font-size: 20px; font-weight: 600; margin-bottom: 5px; }
.fp-sub { font-size: 13px; color: var(--text2); }
.fp-controls { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.fp-progress-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted); font-family: var(--mono);
}
.fp-btns { display: flex; align-items: center; justify-content: center; gap: 16px; }

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; color: var(--muted); text-align: center;
}
.empty-state i { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; font-weight: 500; margin-bottom: 6px; color: var(--text2); }
.empty-state span { font-size: 13px; }

/* ── TOAST ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--player-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  padding: 9px 18px; border-radius: 24px;
  z-index: 500;
  animation: toastIn 0.25s cubic-bezier(0.34,1.56,0.64,1), toastOut 0.2s 1.8s ease forwards;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-8px); } }

/* ── LOADING SKELETON ──────────────────────────────────── */
.loading-state { padding: 24px 28px; }
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton-hero {
  width: 100%; aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #ebebf5 25%, #f5f5ff 50%, #ebebf5 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 24px;
}
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.skeleton-card {
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #ebebf5 25%, #f5f5ff 50%, #ebebf5 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
}

/* ── VIDEO MODAL ───────────────────────────────────────── */
.video-modal {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: min(860px, 95vw);
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.22s cubic-bezier(0.34,1.56,0.64,1);
  display: flex; flex-direction: column;
}
.vm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.vm-title { font-size: 15px; font-weight: 600; }
.vm-player { background: #000; flex-shrink: 0; }
.vm-info { padding: 14px 18px 18px; overflow-y: auto; }
.vm-desc { font-size: 13.5px; line-height: 1.6; color: var(--text2); margin-bottom: 10px; }
.vm-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.vm-meta i { font-size: 13px; margin-right: 3px; }

/* ── SFTP PATH BOX ─────────────────────────────────────── */
.sftp-path-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.sftp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sftp-row:last-child { border-bottom: none; }
.sftp-label { color: var(--text2); display: flex; align-items: center; gap: 6px; min-width: 90px; flex-shrink: 0; }
.sftp-label i { font-size: 15px; }
.sftp-row code { font-family: var(--mono); font-size: 12px; color: var(--accent2); background: var(--surface2); padding: 3px 8px; border-radius: 5px; }

.modal-section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 10px; }

.json-snippet {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.json-snippet pre {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  padding: 14px 14px 14px;
  overflow-x: auto;
  line-height: 1.6;
  scrollbar-width: thin;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--surface3); border: 1px solid var(--border2);
  color: var(--text2); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font);
  transition: background 0.12s, color 0.12s;
}
.copy-btn:hover { background: var(--accent-dim); color: #3a6ebf; border-color: var(--accent); }

/* ── PAGE TRANSITIONS ──────────────────────────────────── */
.page-fade {
  animation: pageFade 0.2s ease;
}
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── PROGRESS BAR ON THUMBNAIL ─────────────────────────── */
.thumb-progress {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  height: 3px; background: rgba(255,255,255,0.2);
}
.thumb-progress div { height: 100%; background: var(--accent); border-radius: 0 2px 2px 0; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    grid-template-areas:
      "main"
      "player"
      "mobnav";
  }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    z-index: 30;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar-overlay.visible { display: block; }

  .menu-btn { display: flex; }

  .mobile-nav { display: flex; }

  .search-bar kbd { display: none; }
  .topbar-actions .icon-btn:not(:last-child) { display: none; }

  .page-section { padding: 16px 16px 0; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .player {
    padding: 0 14px;
    flex-wrap: wrap;
    height: auto;
    gap: 0;
    padding: 10px 14px 8px;
    row-gap: 6px;
  }
  .now-playing { flex: 1; min-width: 200px; }
  .player-center { flex: 100%; order: 3; max-width: 100%; }
  .player-right { display: none; }

  .ctrl-btn { width: 36px; height: 36px; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero-title { font-size: 15px; }
}

/* ── AUTH STYLES ───────────────────────────────────────── */
.auth-btn {
  flex: 1; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font); transition: all 0.12s;
}
.auth-btn-outline {
  background: none; border: 1px solid var(--border2); color: var(--text2);
}
.auth-btn-outline:hover { background: var(--surface2); color: var(--text); }
.auth-btn-fill {
  background: var(--accent); border: 1px solid var(--accent); color: #1a1830;
}
.auth-btn-fill:hover { background: #7aabf5; }

.auth-modal { width: min(440px, 95vw); }

.auth-tabs { display: flex; gap: 4px; flex: 1; }
.auth-tab {
  flex: 1; padding: 7px; border-radius: 7px; border: none;
  background: none; color: var(--text2); font-size: 14px;
  font-weight: 500; cursor: pointer; font-family: var(--font);
  transition: background 0.12s, color 0.12s;
}
.auth-tab.active { background: var(--surface3); color: var(--text); }
.auth-tab:hover:not(.active) { background: var(--surface2); }

.auth-form { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.auth-error {
  background: rgba(224,92,92,0.12); border: 1px solid rgba(224,92,92,0.25);
  color: var(--red); font-size: 13px; padding: 9px 12px;
  border-radius: 7px; margin-bottom: 4px;
}

.field-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field-group label { font-size: 12px; font-weight: 500; color: var(--text2); }
.field-group input, .field-group textarea, .field-group select {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; padding: 9px 12px; color: var(--text);
  font-size: 13.5px; font-family: var(--font); outline: none;
  transition: border-color 0.12s; width: 100%;
}
.field-group input:focus, .field-group textarea:focus, .field-group select:focus {
  border-color: rgba(124,110,242,0.5);
}
.field-group textarea { resize: vertical; }
.field-group select { appearance: none; cursor: pointer; }

.field-row { display: flex; gap: 12px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 4px; display: flex; align-items: center;
}

.submit-btn {
  width: 100%; padding: 10px; border-radius: 8px;
  background: var(--accent); border: none; color: #1a1830;
  font-size: 14px; font-weight: 500; cursor: pointer;
  font-family: var(--font); transition: background 0.12s, transform 0.1s;
}
.submit-btn:hover { background: #9085f5; }
.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.checkbox-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text2); cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

/* ── ADMIN STYLES ──────────────────────────────────────── */
.admin-dash-btn {
  width: 100%; margin-top: 6px; padding: 8px 10px;
  background: var(--accent-dim); border: 1px solid rgba(160,196,255,0.35);
  border-radius: 8px; color: #3a6ebf; font-size: 13px;
  font-weight: 500; cursor: pointer; font-family: var(--font);
  display: flex; align-items: center; gap: 6px; justify-content: center;
  transition: background 0.12s;
}
.admin-dash-btn:hover { background: rgba(160,196,255,0.3); }

.admin-tabs {
  display: flex; gap: 6px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.admin-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; border: none;
  background: none; color: var(--text2); font-size: 13.5px;
  font-weight: 500; cursor: pointer; font-family: var(--font);
  transition: background 0.12s, color 0.12s;
}
.admin-tab.active { background: var(--accent-dim); color: #3a6ebf; }
.admin-tab:hover:not(.active) { background: var(--surface2); color: var(--text); }

.admin-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.admin-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 14px; text-align: center;
}
.admin-stat-card i { font-size: 22px; color: #3a6ebf; display: block; margin-bottom: 6px; }
.admin-stat-val { font-size: 22px; font-weight: 600; }
.admin-stat-label { font-size: 12px; color: var(--text2); margin-top: 2px; }

.admin-section-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.admin-top-list { display: flex; flex-direction: column; gap: 2px; }
.admin-top-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px; font-size: 13px;
  transition: background 0.12s;
}
.admin-top-row:hover { background: var(--surface); }
.admin-top-rank {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.admin-top-views { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 4px; }

.admin-toolbar { margin-bottom: 14px; }
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  padding: 10px 14px; text-align: left; font-size: 11px;
  font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
  background: var(--surface); white-space: nowrap;
}
.admin-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text2); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface2); }
.admin-td-title { color: var(--text) !important; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-actions { display: flex; gap: 4px; }

.pub-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.pub-badge.pub    { background: var(--accent2-dim); color: var(--accent2); }
.pub-badge.unpub  { background: var(--surface3);    color: var(--muted); }
.pub-badge.admin  { background: var(--accent-dim);  color: #3a6ebf; }
.pub-badge.user   { background: var(--surface3);    color: var(--muted); }

.danger-btn:hover { color: var(--red) !important; background: rgba(224,92,92,0.1) !important; }

/* Media modal form */
.media-modal { width: min(620px, 96vw); max-height: 92vh; overflow-y: auto; }
.media-form { display: flex; flex-direction: column; gap: 14px; }
.upload-zone.compact { padding: 16px; }
.upload-zone.compact i { font-size: 24px; display: inline; margin-right: 8px; }
.upload-zone.compact span { font-size: 13px; }

/* ── VIDEO MODAL TABS ──────────────────────────────────── */
.vm-tab-bar {
  display: flex; gap: 4px; padding: 12px 18px 0;
  border-bottom: 1px solid var(--border);
}
.vm-tab {
  padding: 6px 14px; border-radius: 7px 7px 0 0; border: none;
  background: none; color: var(--text2); font-size: 13px;
  font-weight: 500; cursor: pointer; font-family: var(--font);
  transition: color 0.12s, background 0.12s;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.vm-tab.active { color: #3a6ebf; border-bottom-color: #A0C4FF; }
.vm-tab:hover:not(.active) { color: var(--text); }

#vmTabContent { padding: 14px 18px 18px; }

.comment-input-row {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.comments-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item { display: flex; gap: 10px; align-items: flex-start; }

/* ── RATINGS ───────────────────────────────────────────── */
.ratings-wrap { display: flex; flex-direction: column; gap: 16px; }
.rating-summary { display: flex; align-items: center; gap: 16px; }
.rating-big { font-size: 40px; font-weight: 600; line-height: 1; }
.star-picker { display: flex; gap: 4px; }
.star-btn {
  font-size: 28px; background: none; border: none;
  color: var(--surface3); cursor: pointer;
  transition: color 0.12s, transform 0.1s;
  line-height: 1;
}
.star-btn.active { color: var(--yellow); }
.star-btn:hover  { color: var(--yellow); transform: scale(1.15); }

/* ── PROFILE PAGE ──────────────────────────────────────── */
.profile-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.profile-name { font-size: 20px; font-weight: 600; margin-bottom: 2px; }
.profile-username { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.profile-role-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.profile-role-badge.admin { background: var(--accent-dim); color: #3a6ebf; }
.profile-role-badge.user  { background: var(--surface3); color: var(--text2); }
.profile-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }

.edit-profile-form { display: flex; flex-direction: column; gap: 14px; }
.color-swatch {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.12s, transform 0.12s;
}
.color-swatch.selected { border-color: #1a1830; transform: scale(1.2); }
.color-swatch:hover { transform: scale(1.15); }

/* ── CARD BOOKMARK BTN ─────────────────────────────────── */
.card-bookmark {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(255,255,255,0.85); border: none;
  color: var(--text2); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.12s, color 0.12s;
}
.media-card:hover .card-bookmark { opacity: 1; }
.card-bookmark.saved { opacity: 1; color: #3a6ebf; }
.card-bookmark:hover { color: #fff !important; }

/* ── RESPONSIVE OVERRIDES ──────────────────────────────── */
@media (max-width: 768px) {
  .admin-stats-grid { grid-template-columns: repeat(2,1fr); }
  .profile-stats    { grid-template-columns: repeat(2,1fr); }
  .field-row        { flex-direction: column; }
}
@media (max-width: 480px) {
  .admin-stats-grid { grid-template-columns: repeat(2,1fr); }
}
