/* ═══════════════════════════════════════════════
   RBH COMMUNITY — DESIGN SYSTEM PREMIUM
   Oro: #C4A56D  |  Marino: #1A1B38  |  Negro: #0D0E1E
   ═══════════════════════════════════════════════ */
:root {
  --bg:          #1A1B38;
  --bg-deep:     #0D0E1E;
  --bg-card:     #1E2040;
  --bg-card2:    #222448;
  --bg-input:    #141530;
  --bg-hover:    rgba(196,165,109,.07);

  --gold:        #C4A56D;
  --gold-light:  #D4B87D;
  --gold-dark:   #A48850;
  --gold-dim:    rgba(196,165,109,.7);
  --gold-faint:  rgba(196,165,109,.12);
  --gold-glow:   rgba(196,165,109,.25);
  --gold-grad:   linear-gradient(135deg, #A48850 0%, #C4A56D 50%, #D4B87D 100%);
  --gold-grad2:  linear-gradient(90deg, #C4A56D, #D4B87D);

  --border:      rgba(196,165,109,.18);
  --border-soft: rgba(255,255,255,.06);

  --text:        #FFFFFF;
  --text-muted:  rgba(196,165,109,.7);
  --text-dim:    rgba(255,255,255,.25);

  --sidebar-w:   260px;
  --player-h:    116px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
}

/* ── TEMA CLARO ──────────────────────────────── */
[data-theme="light"] {
  --bg:          #F0EBE1;
  --bg-deep:     #E6DFD4;
  --bg-card:     #FFFFFF;
  --bg-card2:    #F7F3ED;
  --bg-input:    #EDE7DC;
  --bg-hover:    rgba(196,165,109,.12);
  --border:      rgba(164,136,80,.28);
  --border-soft: rgba(0,0,0,.08);
  --text:        #1A1B38;
  --text-muted:  #7A6035;
  --text-dim:    rgba(26,27,56,.38);
}
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #E0D8CC 0%, #CEC4B6 100%);
}
[data-theme="light"] .player {
  background: rgba(235,228,218,.96);
}
[data-theme="light"] .mobile-nav {
  background: rgba(235,228,218,.96);
  border-top-color: rgba(164,136,80,.22);
}
[data-theme="light"] .auth-screen {
  background: linear-gradient(160deg, var(--bg-deep) 0%, #d9cfc2 60%, #c9bfb2 100%);
}
[data-theme="light"] .topbar {
  background: rgba(240,235,225,.92);
  border-bottom-color: rgba(164,136,80,.2);
}
[data-theme="light"] .track-card {
  background: #FFFFFF;
  border-color: rgba(164,136,80,.18);
}
[data-theme="light"] .track-card:hover { box-shadow: 0 8px 28px rgba(164,136,80,.18); }
[data-theme="light"] .modal-panel { background: #FEFCF8; }
[data-theme="light"] .fullscreen-player .fs-bg { filter: brightness(.6) saturate(.8); }

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

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Inter', 'Poppins', sans-serif;
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
.gold { color: var(--gold); }
.req { color: var(--gold); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-glow); border-radius: 4px; }

/* ═══════════════════════════════════════════════
   AUTH
   ═══════════════════════════════════════════════ */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(160deg, var(--bg-deep) 0%, #0a0b1a 60%, #000 100%);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  z-index: 9999;
}

.auth-glow {
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(196,165,109,.1) 0%, transparent 65%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.auth-logo-wrap {
  margin-bottom: 32px;
  z-index: 1;
}
.auth-logo-wrap img {
  width: 200px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 24px rgba(196,165,109,.3));
}

.auth-box {
  position: relative;
  z-index: 1;
  background: rgba(30, 32, 64, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04), 0 0 60px rgba(196,165,109,.06);
}

.auth-box::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 2px;
  background: var(--gold-grad);
  border-radius: 0 0 4px 4px;
}

.auth-welcome {
  text-align: center;
  margin-bottom: 28px;
}
.auth-welcome h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}
.auth-welcome p { font-size: 13px; color: var(--text-muted); }

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 26px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .22s;
}
.auth-tab.active {
  background: var(--gold-grad);
  color: var(--bg-deep);
  box-shadow: 0 3px 12px var(--gold-glow);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.input-group { display: flex; flex-direction: column; gap: 7px; }
.input-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.input-group input,
.input-group select,
.input-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,165,109,.15);
}
.input-group input::placeholder,
.input-group textarea::placeholder { color: var(--text-dim); }
.input-group select { appearance: none; cursor: pointer; }
.input-group select option { background: var(--bg-card); color: var(--text); }
.input-group textarea { resize: vertical; line-height: 1.5; }

.btn-primary {
  background: var(--gold-grad);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 14px;
  padding: 14px;
  border-radius: 50px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: 6px;
  box-shadow: 0 6px 24px var(--gold-glow);
  transition: opacity .2s, transform .1s, box-shadow .2s;
  width: 100%;
}
.btn-primary:hover { opacity: .92; box-shadow: 0 10px 32px rgba(196,165,109,.4); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.form-error   { color: #ff7c96; font-size: 12px; min-height: 16px; font-weight: 500; }
.form-success { color: var(--gold-light); font-size: 12px; min-height: 16px; font-weight: 500; }

/* ═══════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  background: linear-gradient(180deg, var(--bg-deep) 0%, #10112a 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 12px 16px;
  grid-row: 1 / 2;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}
.sidebar-logo img { width: 160px; height: auto; display: block; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.45);
  font-size: 14px;
  font-weight: 500;
  transition: all .18s;
  text-align: left;
  position: relative;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active {
  color: var(--gold-light);
  background: rgba(196,165,109,.1);
}
.nav-item.active svg { fill: var(--gold); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--gold-grad);
  border-radius: 0 3px 3px 0;
}

.nav-divider { height: 1px; background: var(--border); margin: 10px 4px; }
.nav-label {
  padding: 4px 14px 5px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(196,165,109,.4);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--gold-faint);
  border: 1px solid var(--border);
  margin-top: 8px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--gold-grad);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-info span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span:first-child { font-size: 13px; font-weight: 700; color: var(--text); }
.user-role { font-size: 11px; color: var(--gold); font-weight: 600; }
.logout-btn {
  color: var(--text-dim);
  transition: color .2s;
  padding: 5px;
  border-radius: 7px;
  flex-shrink: 0;
}
.logout-btn:hover { color: #ff7c96; background: rgba(255,124,150,.1); }

/* MAIN */
.main-content {
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(13, 14, 30, 0.7);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo img { height: 40px; width: auto; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }

.preview-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--gold-faint);
  border: 1px solid var(--border);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 50px;
  letter-spacing: .02em;
  transition: all .2s;
}
.preview-btn:hover { background: rgba(196,165,109,.2); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gold-grad);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-user-info { display: flex; flex-direction: column; }
.topbar-user-info strong { font-size: 13px; font-weight: 700; color: var(--gold-light); }
.topbar-user-info span { font-size: 11px; color: var(--text-dim); }

/* VIEWS */
.views-wrap { flex: 1; overflow-y: auto; padding: 28px 28px 20px; }
.view { display: none; animation: fadeIn .25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-header { margin-bottom: 26px; }
.view-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: -.3px;
}
.view-subtitle { color: var(--text-muted); font-size: 14px; }

/* ═══════════════════════════════════════════════
   SECTION TITLE & CATEGORY CHIPS
   ═══════════════════════════════════════════════ */
.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.cat-chip {
  padding: 7px 16px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: rgba(255,255,255,.5);
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
}
.cat-chip:hover { color: var(--text); border-color: var(--border); }
.cat-chip.active {
  background: var(--gold-grad);
  color: var(--bg-deep);
  border-color: transparent;
  box-shadow: 0 3px 12px var(--gold-glow);
}

/* ═══════════════════════════════════════════════
   TRACK CARDS
   ═══════════════════════════════════════════════ */
.tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.tracks-grid-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }

.track-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  position: relative;
  overflow: hidden;
  animation: fadeIn .3s ease both;
}
.track-card:hover {
  transform: translateY(-4px);
  border-color: rgba(196,165,109,.3);
  box-shadow: 0 12px 36px rgba(0,0,0,.45), 0 0 0 1px rgba(196,165,109,.15);
}
.track-card.playing {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(196,165,109,.35), 0 8px 28px rgba(196,165,109,.15);
}

.track-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  background: var(--bg-card2);
}
.track-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.track-card:hover .track-cover img { transform: scale(1.04); }

.track-cover-fallback {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a2060, #2a1a60);
}

/* Play overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .22s;
  border-radius: 10px;
}
.track-card:hover .play-overlay { opacity: 1; }
.track-card.playing .play-overlay { opacity: 1; background: rgba(0,0,0,.25); }

.play-overlay-btn {
  background: var(--gold-grad);
  color: var(--bg-deep);
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(196,165,109,.5);
  transition: transform .15s;
}
.play-overlay-btn:hover { transform: scale(1.1); }

/* Wave bars in playing card */
.card-wave {
  display: flex;
  align-items: center;
  gap: 2px;
}
.card-wave span {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: var(--gold);
  animation: wave 1s ease-in-out infinite;
}
.card-wave span:nth-child(1) { height: 8px; animation-delay: 0s; }
.card-wave span:nth-child(2) { height: 14px; animation-delay: .1s; }
.card-wave span:nth-child(3) { height: 18px; animation-delay: .2s; }
.card-wave span:nth-child(4) { height: 14px; animation-delay: .3s; }
.card-wave span:nth-child(5) { height: 8px; animation-delay: .4s; }
@keyframes wave { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.4); } }

.track-card-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  margin-bottom: 4px;
}
.track-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.track-card-cat {
  font-size: 11px;
  color: var(--gold-dim);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-card-dur {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 4px;
}

/* Fav button on card */
.card-fav-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(13,14,30,.75);
  backdrop-filter: blur(8px);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  border: 1px solid var(--border-soft);
  color: rgba(255,255,255,.4);
  z-index: 2;
}
.track-card:hover .card-fav-btn { opacity: 1; }
.card-fav-btn.is-fav { opacity: 1; color: var(--gold); }
.card-fav-btn:hover { color: var(--gold); }

/* Admin delete on card */
.card-del-btn {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(13,14,30,.75);
  backdrop-filter: blur(8px);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  border: 1px solid var(--border-soft);
  color: rgba(255,255,255,.4);
  z-index: 2;
}
.track-card:hover .card-del-btn { opacity: 1; }
.card-del-btn:hover { color: #ff7c96; }

/* ═══════════════════════════════════════════════
   LIBRARY TABS + TABLE
   ═══════════════════════════════════════════════ */
.lib-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.lib-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.4);
  border-bottom: 2px solid transparent;
  transition: all .2s;
  white-space: nowrap;
  margin-bottom: -1px;
}
.lib-tab:hover { color: var(--text); }
.lib-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.tracks-list-wrap { overflow-x: auto; }

.tracks-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tracks-table thead tr { border-bottom: 1px solid var(--border); }
.tracks-table th {
  text-align: left;
  padding: 10px 14px;
  color: rgba(196,165,109,.5);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.tracks-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.tracks-table tbody tr { transition: background .15s; cursor: pointer; }
.tracks-table tbody tr:hover td { background: var(--bg-hover); }
.tracks-table tbody tr.playing td { color: var(--gold-light); }

/* Library row controls */
.lib-controls { display: flex; align-items: center; gap: 4px; }
.lib-ctrl {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.35);
  transition: color .15s, background .15s;
}
.lib-ctrl:hover { color: var(--text); background: rgba(255,255,255,.07); }
.lib-ctrl-play {
  background: var(--gold-grad);
  color: var(--bg-deep) !important;
  width: 34px; height: 34px;
  box-shadow: 0 2px 10px var(--gold-glow);
}
.lib-ctrl-play:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(196,165,109,.45) !important; }
.lib-ctrl:disabled { opacity: .25; cursor: not-allowed; }

.lib-wave { display: flex; align-items: center; justify-content: center; gap: 2px; height: 18px; }
.lib-wave span { display: block; width: 3px; border-radius: 3px; background: var(--gold); animation: wave 1s ease-in-out infinite; }
.lib-wave span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.lib-wave span:nth-child(2) { height: 12px; animation-delay: .1s; }
.lib-wave span:nth-child(3) { height: 16px; animation-delay: .2s; }
.lib-wave span:nth-child(4) { height: 12px; animation-delay: .3s; }
.lib-wave span:nth-child(5) { height: 6px;  animation-delay: .4s; }

/* ═══════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 50px;
  padding: 10px 20px;
  max-width: 440px;
  margin-top: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.search-bar:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,165,109,.12); }
.search-bar svg { fill: rgba(196,165,109,.5); flex-shrink: 0; }
.search-bar input { background: none; border: none; outline: none; color: var(--text); font-size: 14px; flex: 1; }
.search-bar input::placeholder { color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   PLAYER
   ═══════════════════════════════════════════════ */
.player {
  grid-column: 1 / 3;
  background: rgba(10, 11, 26, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 8px 24px;
  gap: 16px;
  min-height: var(--player-h);
  position: relative;
}
.player::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--gold-grad);
  opacity: .6;
}

.player-track {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 280px;
  flex-shrink: 0;
}
.player-art {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.player-art-wave {
  display: flex;
  align-items: center;
  gap: 2px;
}
.player-art-wave span {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: var(--gold);
  opacity: .7;
}
.player-art-wave span:nth-child(1) { height: 8px; }
.player-art-wave span:nth-child(2) { height: 14px; }
.player-art-wave span:nth-child(3) { height: 20px; }
.player-art-wave span:nth-child(4) { height: 14px; }
.player-art-wave span:nth-child(5) { height: 8px; }
.player-art-wave.playing span { animation: wave 1s ease-in-out infinite; opacity: 1; }
.player-art-wave.playing span:nth-child(1) { animation-delay: 0s; }
.player-art-wave.playing span:nth-child(2) { animation-delay: .1s; }
.player-art-wave.playing span:nth-child(3) { animation-delay: .2s; }
.player-art-wave.playing span:nth-child(4) { animation-delay: .3s; }
.player-art-wave.playing span:nth-child(5) { animation-delay: .4s; }

.player-info { overflow: hidden; flex: 1; }
.player-title-text { display: block; font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist-text { display: block; font-size: 12px; color: var(--gold-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.fav-btn-player {
  color: rgba(255,255,255,.3);
  padding: 6px;
  border-radius: 7px;
  transition: color .2s;
  flex-shrink: 0;
}
.fav-btn-player:hover { color: var(--gold); }
.fav-btn-player.is-fav { color: var(--gold); }

.player-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.player-controls { display: flex; align-items: center; gap: 8px; }
.ctrl-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.5);
  transition: color .15s, background .15s;
}
.ctrl-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.play-btn {
  background: var(--gold-grad) !important;
  color: var(--bg-deep) !important;
  width: 44px; height: 44px;
  box-shadow: 0 4px 18px var(--gold-glow);
  transition: transform .15s, box-shadow .15s !important;
}
.play-btn:hover { transform: scale(1.06); box-shadow: 0 6px 26px rgba(196,165,109,.5) !important; }

.player-progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-label { font-size: 11px; color: var(--gold-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  transition: height .15s;
}
.progress-track:hover { height: 6px; }
.progress-played {
  height: 100%;
  background: var(--gold-grad);
  border-radius: 50px;
  pointer-events: none;
  position: relative;
  transition: width .1s linear;
}
.progress-played::after {
  content: '';
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold-light);
  opacity: 0;
  transition: opacity .15s;
}
.progress-track:hover .progress-played::after { opacity: 1; }

.player-right { width: 160px; flex-shrink: 0; display: flex; justify-content: flex-end; }
.player-volume { display: flex; align-items: center; gap: 8px; width: 140px; }
.player-volume svg { fill: rgba(196,165,109,.4); flex-shrink: 0; }
.volume-slider {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 50px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 6px var(--gold-glow);
}

/* ═══════════════════════════════════════════════
   UPLOAD FORM
   ═══════════════════════════════════════════════ */
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 680px;
}
.upload-card::before {
  content: '';
  display: block;
  height: 2px;
  background: var(--gold-grad);
  border-radius: 2px 2px 0 0;
  margin: -36px -36px 32px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.yt-url-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.btn-fetch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-faint);
  border: 1px solid var(--border);
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all .2s;
  flex-shrink: 0;
}
.btn-fetch:hover { background: rgba(196,165,109,.2); }
.btn-fetch:disabled { opacity: .4; cursor: not-allowed; }

.at-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 20px;
}
.at-preview img { width: 100px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.at-preview-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.at-preview-channel { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   USERS TABLE
   ═══════════════════════════════════════════════ */
.users-table-wrap { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table thead tr { border-bottom: 1px solid var(--border); }
.users-table th {
  text-align: left;
  padding: 10px 14px;
  color: rgba(196,165,109,.5);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.users-table td { padding: 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.users-table tr:hover td { background: var(--bg-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
}
.badge-admin   { background: rgba(196,165,109,.12); color: var(--gold-light); border: 1px solid rgba(196,165,109,.25); }
.badge-student { background: rgba(255,255,255,.06);  color: rgba(255,255,255,.5); border: 1px solid var(--border-soft); }

.btn-icon { padding: 7px; border-radius: 7px; color: rgba(255,255,255,.35); transition: color .2s, background .2s; }
.btn-icon:hover { color: #ff7c96; background: rgba(255,124,150,.1); }

/* ═══════════════════════════════════════════════
   MISC
   ═══════════════════════════════════════════════ */
.loading {
  color: var(--text-dim);
  padding: 56px 20px;
  text-align: center;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loading::before {
  content: '';
  width: 28px; height: 28px;
  border: 2px solid rgba(196,165,109,.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state-icon {
  width: 72px; height: 72px;
  background: var(--gold-faint);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.empty-state p { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-state span { font-size: 13px; color: rgba(196,165,109,.5); }

/* ═══════════════════════════════════════════════
   MOBILE PREVIEW MODAL
   ═══════════════════════════════════════════════ */
.mobile-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 20, .9);
  backdrop-filter: blur(16px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.phone-frame {
  width: 390px; height: 780px;
  background: #0a0b1a;
  border-radius: 48px;
  border: 2px solid rgba(196,165,109,.3);
  box-shadow: 0 0 0 6px #111827, 0 0 0 8px rgba(196,165,109,.15), 0 40px 80px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 10px;
  overflow: hidden;
}
.phone-notch { width: 110px; height: 28px; background: #0a0b1a; border-radius: 0 0 16px 16px; z-index: 2; flex-shrink: 0; margin-bottom: 4px; border: 2px solid #111827; border-top: none; }
.phone-screen { flex: 1; width: 100%; border-radius: 10px; overflow: hidden; background: var(--bg); }
.phone-screen iframe { width: 100%; height: 100%; border: none; display: block; }
.phone-home-bar { width: 120px; height: 4px; background: rgba(255,255,255,.2); border-radius: 50px; margin-top: 10px; flex-shrink: 0; }
.preview-close-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 50px;
  transition: all .2s;
}
.preview-close-btn:hover { background: rgba(255,255,255,.12); color: var(--text); }

/* ═══════════════════════════════════════════════
   MOBILE NAV
   ═══════════════════════════════════════════════ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(10, 11, 26, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  color: rgba(255,255,255,.35);
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  transition: color .18s;
  letter-spacing: .02em;
}
.mobile-nav-item.active { color: var(--gold); }
.mobile-nav-item.active svg { fill: var(--gold); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding-bottom: calc(var(--player-h) + 108px);
    height: 100vh;
    overflow: hidden;
  }
  .sidebar { display: none; }
  .main-content { grid-column: 1; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  .topbar { padding: 8px 16px; }
  .topbar-logo img { height: 34px; }
  .preview-btn { display: none; }
  .views-wrap { flex: 1; overflow-y: auto; padding: 16px 14px; -webkit-overflow-scrolling: touch; }
  .tracks-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .view-header h2 { font-size: 22px; }
  .search-bar { max-width: 100%; }
  .lib-tabs { gap: 0; }
  .lib-tab { padding: 8px 12px; font-size: 12px; }
  .upload-card { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .yt-url-row { flex-direction: column; }
  .btn-fetch { width: 100%; justify-content: center; }
  .player {
    display: none;
    position: fixed;
    left: 0; right: 0;
    bottom: 64px;
    height: auto;
    min-height: 70px;
    padding: 6px 12px 8px;
    gap: 8px;
    flex-wrap: wrap;
    z-index: 99;
  }
  .player.mobile-visible { display: flex; }
  .player-volume { display: none; }
  .player-track { width: auto; flex-shrink: 0; }
  .player-art { width: 44px; height: 44px; border-radius: 8px; }
  .player-info { max-width: 100px; }
  .player-title-text { font-size: 12px; }
  .player-artist-text { font-size: 11px; }
  .ctrl-btn { width: 30px; height: 30px; }
  .play-btn { width: 38px !important; height: 38px !important; }
  .player-right { display: none; }
  .fav-btn-player { display: none; }
  .mobile-nav { display: flex; }
  .tracks-table thead { display: none; }
  .tracks-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    gap: 3px;
    cursor: pointer;
  }
  .tracks-table td { padding: 1px 0; border: none; font-size: 13px; }
  .tracks-table td:nth-child(1) { display: none; }
  .users-table thead { display: none; }
  .users-table tbody tr {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
  }
  .users-table td { padding: 0; border: none; }
  .users-table td:nth-child(1) { display: none; }
  .users-table td:nth-child(3) { margin-left: auto; }

  /* Progress bar — bigger touch target */
  .progress-track {
    height: 6px;
    padding: 12px 0;
    background-clip: content-box;
    touch-action: none;
  }
  .progress-track:hover { height: 6px; }

  /* Volume slider — bigger thumb for fingers */
  .volume-slider { touch-action: none; }
  .volume-slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }
  .volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }
}

/* ═══════════════════════════════════════════════
   PLAYER ACTIONS ROW
   ═══════════════════════════════════════════════ */
.player-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 5px;
}
.player-act-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: rgba(196,165,109,.45);
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.player-act-btn:hover  { color: var(--text); background: rgba(255,255,255,.07); }
.player-act-btn.active { color: var(--gold); }
.player-act-btn.completed { color: var(--gold); }
@media (max-width: 768px) {
  /* Player first row: track info + controls */
  .player-track { flex-shrink: 0; }
  .player-center {
    flex: 1;
    min-width: 0;
  }
  /* Actions row spans full player width below the controls */
  .player-actions {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    order: 10;           /* push below the track+center row */
    justify-content: space-around;
    padding: 2px 0 0;
    margin-top: 0;
    border-top: 1px solid rgba(196,165,109,.1);
    padding-top: 4px;
  }
  .player-actions::-webkit-scrollbar { display: none; }
  .player-act-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    flex: 1;
    border-radius: 8px;
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════
   COMPLETED BADGE ON CARDS
   ═══════════════════════════════════════════════ */
.card-done-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: var(--gold-grad);
  color: var(--bg-deep);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
  pointer-events: none;
}
.card-share-btn {
  position: absolute;
  bottom: 6px; right: 34px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(10,11,26,.7);
  color: rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .2s, color .15s;
}
.track-card:hover .card-share-btn { opacity: 1; }
.card-share-btn:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════
   MODAL OVERLAY
   ═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 520px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-panel.modal-sm { max-width: 380px; }
.modal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 700; flex: 1; margin: 0; }
.modal-subtitle   { color: var(--text-muted); font-size: 11px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-close {
  color: var(--text-dim); font-size: 18px;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.07); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border-soft); flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   NOTAS
   ═══════════════════════════════════════════════ */
.notes-compose {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.notes-ts-row { display: flex; align-items: center; gap: 8px; }
.note-ts-badge {
  background: var(--gold-faint); border: 1px solid var(--border);
  color: var(--gold); font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px; cursor: pointer;
}
.notes-compose textarea, .comment-compose textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border-soft);
  border-radius: var(--radius); color: var(--text); resize: vertical;
  outline: none; transition: border-color .15s;
}
.notes-compose textarea:focus, .comment-compose textarea:focus { border-color: var(--border); }
.note-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.note-ts {
  background: var(--gold-faint); border: 1px solid var(--border);
  color: var(--gold); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; flex-shrink: 0; cursor: pointer;
}
.note-ts:hover { background: var(--gold); color: var(--bg-deep); }
.note-body  { flex: 1; }
.note-text  { font-size: 13px; line-height: 1.5; margin-bottom: 3px; }
.note-date  { font-size: 11px; color: var(--text-dim); }
.note-del   { color: var(--text-dim); font-size: 20px; padding: 0 4px; line-height: 1; }
.note-del:hover { color: var(--text); }

/* ═══════════════════════════════════════════════
   COMENTARIOS
   ═══════════════════════════════════════════════ */
.comment-compose {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.comment-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold-faint); border: 1px solid var(--border);
  color: var(--gold); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-header-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-user  { font-size: 13px; font-weight: 700; }
.comment-time  { font-size: 11px; color: var(--text-dim); }
.comment-text  { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin-bottom: 6px; }
.comment-actions { display: flex; align-items: center; gap: 12px; }
.comment-like-btn { color: var(--text-dim); font-size: 12px; }
.comment-like-btn.liked, .comment-like-btn:hover { color: #e55; }
.comment-del-btn  { color: var(--text-dim); font-size: 12px; }
.comment-del-btn:hover { color: var(--text); }

/* ═══════════════════════════════════════════════
   COMPARTIR
   ═══════════════════════════════════════════════ */
.share-title { font-weight: 600; margin-bottom: 14px; color: var(--text-muted); font-size: 13px; }
.share-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-btn {
  padding: 13px 10px;
  background: var(--bg-card2); border: 1px solid var(--border-soft);
  border-radius: var(--radius); font-size: 13px; font-weight: 600;
  transition: all .15s; text-align: center;
}
.share-btn:hover { border-color: var(--border); background: var(--bg-hover); color: var(--gold); }

/* ═══════════════════════════════════════════════
   TEMPORIZADOR DE SUEÑO
   ═══════════════════════════════════════════════ */
.sleep-countdown {
  text-align: center; padding: 10px 14px;
  background: var(--gold-faint); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13px; color: var(--text-muted);
}
.sleep-countdown strong { color: var(--gold); font-size: 20px; font-weight: 800; display: block; }
.sleep-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sleep-opt-btn {
  padding: 14px; background: var(--bg-card2);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  font-size: 14px; font-weight: 700; transition: all .15s;
}
.sleep-opt-btn:hover { border-color: var(--gold); color: var(--gold); }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 13px; font-weight: 600; background: none;
  transition: all .15s; cursor: pointer;
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

/* ═══════════════════════════════════════════════
   FULLSCREEN PLAYER
   ═══════════════════════════════════════════════ */
.fullscreen-player {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.fs-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(50px) brightness(.25); transform: scale(1.15);
}
.fs-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: var(--text);
  font-size: 18px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.fs-close:hover { background: rgba(255,255,255,.18); }
.fs-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 22px; width: 100%; max-width: 400px; padding: 40px 24px;
}
.fs-art {
  width: 220px; height: 220px; border-radius: var(--radius-xl);
  background: var(--bg-card) center/cover;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 40px rgba(196,165,109,.15);
}
.fs-info { text-align: center; }
.fs-info h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.fs-info p  { color: var(--text-muted); }
.fs-controls { display: flex; align-items: center; gap: 20px; }
.fs-controls .ctrl-btn { width: 50px; height: 50px; }
.fs-controls .play-btn { width: 66px !important; height: 66px !important; }
.fs-progress-wrap {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.fs-volume-wrap {
  display: flex; align-items: center; gap: 10px; width: 70%;
}
.fs-volume-wrap svg { fill: rgba(196,165,109,.4); flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   PROGRESO PERSONAL
   ═══════════════════════════════════════════════ */
.progress-hero {
  display: flex; align-items: center;
  gap: 28px; margin-bottom: 28px;
}
.progress-circle-wrap {
  position: relative; width: 130px; height: 130px; flex-shrink: 0;
}
.progress-circle-svg {
  width: 130px; height: 130px; transform: rotate(-90deg);
}
.pc-bg  { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 8; }
.pc-fill {
  fill: none; stroke: var(--gold); stroke-width: 8;
  stroke-linecap: round; stroke-dasharray: 314; stroke-dashoffset: 314;
  transition: stroke-dashoffset .8s ease;
}
.pc-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.pc-inner span  { font-size: 30px; font-weight: 800; color: var(--gold); line-height: 1; }
.pc-inner small { font-size: 12px; color: var(--text-muted); }
.progress-stat-cards { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pstat-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.pstat-card strong { font-size: 24px; font-weight: 800; color: var(--gold); }
.pstat-card span   { font-size: 12px; color: var(--text-muted); }
.cat-prog-row { margin-bottom: 14px; }
.cat-prog-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.cat-prog-track { height: 6px; background: rgba(255,255,255,.07); border-radius: 50px; overflow: hidden; }
.cat-prog-fill  { height: 100%; background: var(--gold-grad); border-radius: 50px; transition: width .6s ease; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge-item {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 16px; text-align: center; transition: all .2s;
}
.badge-item.earned {
  border-color: var(--border);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(196,165,109,.08) 100%);
  box-shadow: 0 0 20px var(--gold-glow);
}
.badge-item.locked { opacity: .35; filter: grayscale(1); }
.badge-emoji { font-size: 28px; margin-bottom: 8px; }
.badge-name  { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.badge-desc  { font-size: 10px; color: var(--text-muted); line-height: 1.4; }
.badge-toast {
  position: fixed; bottom: 110px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-card); border: 1px solid var(--gold);
  border-radius: var(--radius-lg); padding: 13px 18px;
  display: flex; align-items: center; gap: 12px;
  z-index: 500; box-shadow: 0 8px 32px rgba(196,165,109,.25);
  opacity: 0; transition: all .3s ease; white-space: nowrap;
}
.badge-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.badge-toast-emoji { font-size: 22px; }
.badge-toast strong { font-size: 13px; font-weight: 700; display: block; }
.badge-toast p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ═══════════════════════════════════════════════
   ESTADÍSTICAS
   ═══════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 16px; }
.stats-kpi {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 20px 14px; text-align: center;
}
.stats-kpi strong {
  font-size: 32px; font-weight: 800; display: block; margin-bottom: 4px;
  background: var(--gold-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stats-kpi span { font-size: 12px; color: var(--text-muted); }
.stats-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 12px;
}
.stats-card-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .06em; }
.stats-bar-row   { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.stats-bar-label { width: 160px; flex-shrink: 0; color: var(--text-muted); font-size: 11px; }
.stats-bar-track { flex: 1; height: 6px; background: rgba(255,255,255,.07); border-radius: 50px; overflow: hidden; }
.stats-bar-fill  { height: 100%; background: var(--gold-grad); border-radius: 50px; }
.stats-bar-val   { width: 28px; text-align: right; color: var(--gold); font-weight: 700; font-size: 12px; }
.stats-col-chart { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.stats-col-bar   { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.stats-col-fill  { background: var(--gold-grad); border-radius: 4px 4px 0 0; width: 100%; min-height: 4px; }
.stats-col-label { font-size: 10px; color: var(--text-muted); }
.stats-rank-row  { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.stats-rank-num  { color: var(--gold); font-weight: 800; width: 24px; font-size: 12px; }
.stats-rank-title { flex: 1; font-weight: 600; font-size: 13px; }
.stats-rank-val  { color: var(--text-muted); font-size: 11px; }
@media (max-width: 768px) {
  .stats-bar-label { width: 90px; }
  .progress-hero   { flex-direction: column; gap: 16px; align-items: flex-start; }
  .badges-grid     { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ═══════════════════════════════════════════════
   COMENTARIOS MEJORADOS — HILOS + EDICIÓN
   ═══════════════════════════════════════════════ */
.comment-item {
  display: flex; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold-grad); color: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.comment-user  { font-size: 12px; font-weight: 700; color: var(--gold-light); }
.comment-time  { font-size: 11px; color: var(--text-dim); }
.comment-edited { font-size: 10px; color: var(--text-dim); font-style: italic; }
.comment-text  { font-size: 13px; line-height: 1.5; word-break: break-word; margin-bottom: 6px; }
.comment-actions { display: flex; align-items: center; gap: 10px; }
.comment-like-btn {
  background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer;
  padding: 3px 7px; border-radius: 20px; transition: background .15s, color .15s;
}
.comment-like-btn:hover, .comment-like-btn.liked {
  background: rgba(196,165,109,.12); color: var(--gold);
}
.comment-reply-trigger {
  background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer;
  padding: 3px 7px; border-radius: 20px; transition: background .15s;
}
.comment-reply-trigger:hover { background: var(--bg-hover); color: var(--gold); }

/* Menu editar/eliminar */
.comment-menu { display: flex; gap: 4px; margin-left: auto; }
.comment-menu-btn {
  background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer;
  padding: 2px 6px; border-radius: 6px; transition: background .15s, color .15s;
}
.comment-menu-btn:hover { background: var(--bg-hover); color: var(--gold); }
.comment-del-btn:hover  { color: #e55; }

/* Replies */
.reply-item {
  margin-top: 8px;
  border-bottom: none !important;
  border-left: 2px solid var(--gold-glow);
  padding-left: 10px;
}
.reply-item .comment-avatar {
  width: 26px; height: 26px; font-size: 10px;
}
.replies-wrap { margin-top: 8px; }

/* Reply form */
.reply-form { margin-top: 8px; }
.reply-input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px; color: var(--text); font-size: 12px;
  outline: none;
}
.reply-input:focus { border-color: var(--gold); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }

/* ─── Barra de progreso guardado en cards ──── */
.card-resume-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.card-resume-fill {
  height: 100%;
  background: var(--gold-grad2);
  border-radius: inherit;
  opacity: .75;
}

/* ─── Like button on cards ──────────────────── */
.card-like-btn {
  position: absolute;
  top: 8px; left: 8px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(13,14,30,.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(196,165,109,.2);
  border-radius: 20px;
  padding: 4px 8px;
  color: rgba(255,255,255,.5);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s, transform .1s;
  z-index: 2;
}
.card-like-btn:hover {
  color: var(--gold);
  background: rgba(196,165,109,.15);
  border-color: rgba(196,165,109,.5);
  transform: scale(1.06);
}
.card-like-btn.liked {
  color: var(--gold);
  background: rgba(196,165,109,.18);
  border-color: var(--gold);
}
.card-like-btn svg { flex-shrink: 0; }
.card-like-count { line-height: 1; }

/* Comment count badge on track cards */
.track-card-comments {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--text-dim); font-size: 11px;
}
.track-card-comments svg { opacity: .6; }

/* ═══════════════════════════════════════════════
   NOTAS NAV BADGE
   ═══════════════════════════════════════════════ */
.notes-view-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: var(--gold-grad); color: var(--bg-deep);
  font-size: 11px; font-weight: 800; padding: 0 5px;
  margin-left: 8px; vertical-align: middle;
}
.notes-nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--gold-grad); color: var(--bg-deep);
  font-size: 10px; font-weight: 800; padding: 0 4px;
  margin-left: auto;
}

/* ═══════════════════════════════════════════════
   VISTA: MIS NOTAS
   ═══════════════════════════════════════════════ */
.notes-view-topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.notes-view-topbar h2 { font-size: 20px; font-weight: 800; }
.notes-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center;
}
.notes-search-bar { flex: 1; min-width: 140px; }
.notes-select {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px; color: var(--text);
  font-size: 12px; outline: none; cursor: pointer;
}
.notes-select:focus { border-color: var(--gold); }

/* Note groups */
.notes-group { margin-bottom: 20px; }
.notes-group-header {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 14px;
}
.notes-group-thumb {
  width: 36px; height: 36px; border-radius: 7px; flex-shrink: 0;
  background: var(--bg-card2);
}
.notes-group-title { font-size: 13px; font-weight: 700; }
.notes-group-meta  { font-size: 11px; color: var(--text-muted); }
.notes-group-header > .btn-outline { margin-left: auto; }

/* Note cards */
.note-card {
  background: var(--bg-card2); border: 1px solid var(--border-soft);
  border-top: none; padding: 10px 14px;
}
.note-card:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.note-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px;
}
.note-card-actions { display: flex; gap: 4px; margin-left: auto; }
.note-action-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px; border-radius: 6px; transition: background .15s, color .15s;
  display: flex; align-items: center; justify-content: center;
}
.note-action-btn:hover { background: var(--bg-hover); color: var(--gold); }
.note-action-del:hover { color: #e55; }
.note-card-text  { font-size: 13px; line-height: 1.5; word-break: break-word; margin-bottom: 4px; }
.note-card-date  { font-size: 11px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   EXPORT MODAL
   ═══════════════════════════════════════════════ */
.export-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.export-option:last-child { border-bottom: none; }
.export-option-info { flex: 1; }
.export-option-info strong { font-size: 13px; font-weight: 700; display: block; }
.export-option-info span   { font-size: 12px; color: var(--text-muted); }

/* modal-sm already defined but ensure small panel is correct */
.modal-sm { max-width: 380px !important; }

@media (max-width: 600px) {
  .notes-filters { flex-direction: column; }
  .notes-search-bar { min-width: 0; width: 100%; }
  .notes-group-header { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════
   TEMA — BOTÓN TOGGLE
   ═══════════════════════════════════════════════ */
.theme-toggle-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color .2s, background .2s, transform .2s;
  flex-shrink: 0;
}
.theme-toggle-btn:hover { color: var(--gold); background: var(--gold-faint); transform: rotate(20deg); }
.sidebar-theme-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 0;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
}
.sidebar-theme-label { font-size: 11px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   PERFIL DE USUARIO — TARJETA Y MODAL
   ═══════════════════════════════════════════════ */
.profile-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl); padding: 20px; margin-bottom: 24px;
  position: relative;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--gold-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--bg-deep);
  overflow: hidden; border: 3px solid var(--gold-glow);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; }
.profile-display-name {
  font-size: 18px; font-weight: 800; margin-bottom: 2px;
  background: var(--gold-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.profile-username { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.profile-bio { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.profile-edit-btn {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px;
  color: var(--gold); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.profile-edit-btn:hover { background: var(--gold-faint); }

/* Profile modal */
.profile-modal-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gold-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: var(--bg-deep);
  overflow: hidden; margin: 0 auto 8px; border: 3px solid var(--gold-glow);
  cursor: pointer; position: relative;
}
.profile-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.profile-modal-avatar:hover .profile-avatar-overlay { opacity: 1; }
.profile-avatar-hint { font-size: 11px; color: var(--text-dim); text-align: center; margin-bottom: 16px; }

@media (max-width: 600px) {
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-edit-btn { position: static; margin-top: 10px; }
}

/* ── Auth compacto en móvil (botón siempre visible) ─ */
@media (max-width: 480px) {
  .auth-screen { justify-content: flex-start; padding: 14px 16px; }
  .auth-logo-wrap { margin-bottom: 12px; margin-top: 8px; }
  .auth-logo-wrap img { width: 110px !important; height: auto !important; }
  .auth-box { padding: 18px 16px 20px; max-height: none; }
  .auth-welcome { margin-bottom: 12px; }
  .auth-welcome h1 { font-size: 19px; margin-bottom: 3px; }
  .auth-welcome p { font-size: 12px; }
  .auth-tabs { margin-bottom: 12px; padding: 3px; }
  .auth-tab { padding: 8px; font-size: 12px; }
  .auth-form { gap: 10px; }
  .input-group { gap: 4px; }
  .input-group label { font-size: 10px; }
  .input-group input { padding: 10px 12px; font-size: 13px; }
  .btn-primary { padding: 12px; font-size: 13px; }
}

/* ── Logo: fondo transparente forzado ──────────────── */
.auth-logo-wrap,
.auth-logo,
.sidebar-logo,
[class*="logo-wrap"] {
  background: transparent !important;
  background-color: transparent !important;
}
.auth-logo-wrap img,
.auth-logo img,
.sidebar-logo img,
[class*="logo"] img {
  background: transparent !important;
  background-color: transparent !important;
  mix-blend-mode: normal !important;
}

/* ── Tema toggle en topbar visible para todos ─────── */
#theme-toggle-topbar { display: flex !important; }

/* ── Perfil clickeable en topbar y sidebar ─────────── */
.topbar-user { cursor: pointer; border-radius: 10px; padding: 4px 6px; transition: background .18s; }
.topbar-user:hover { background: var(--bg-hover); }
.sidebar-user { cursor: pointer; }
