:root {
  --bg: #0b0c10;
  --bg2: #101218;
  --panel: rgba(255, 255, 255, .035);
  --panel-solid: #14161d;
  --hover: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --text: #eceef3;
  --muted: #8b90a0;
  --faint: #5d6272;
  --accent: #8b7cff;
  --accent2: #4fd1ff;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
  --danger: #ff6b81;
  --warn: #ffb547;
  --ok: #4ade80;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 14px/1.5 "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 124, 255, .16), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(79, 209, 255, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(139, 124, 255, .35); }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--line2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); border: 0; color: #0b0c10; font-weight: 600; box-shadow: 0 6px 20px rgba(139, 124, 255, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger:hover { color: var(--danger); border-color: rgba(255, 107, 129, .4); background: rgba(255, 107, 129, .08); }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 9px; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 107, 129, .1); }
.input {
  height: 38px; padding: 0 12px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line);
  border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 124, 255, .2); }

/* ---------- lista de archivos ---------- */
.list {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; backdrop-filter: blur(12px);
}
.row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); transition: background .15s;
  animation: rowIn .3s ease both;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(255, 255, 255, .025); }
.row.playing { background: rgba(139, 124, 255, .07); }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } }

.thumb {
  position: relative; width: 56px; height: 56px; flex: none; border-radius: 11px; overflow: hidden;
  display: grid; place-items: center; border: 1px solid var(--line); background: var(--bg2);
  cursor: pointer; padding: 0;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.thumb:hover img, .thumb:hover video { transform: scale(1.08); }
.thumb .ext { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.thumb .overlay {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .15s;
}
.thumb:hover .overlay, .row.kind-video .thumb .overlay { opacity: 1; }
.row.kind-video .thumb:hover .overlay { background: rgba(0, 0, 0, .5); }
.thumb.audio { background: linear-gradient(135deg, rgba(139, 124, 255, .25), rgba(79, 209, 255, .18)); color: #fff; }
.thumb.audio svg { width: 22px; height: 22px; }
.thumb.pdf { background: rgba(255, 107, 129, .12); color: #ff8fa0; }
.thumb.other { background: rgba(255, 255, 255, .04); color: var(--muted); }
.playing .thumb.audio { box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(139, 124, 255, .5); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.bars i { width: 3px; background: #fff; border-radius: 2px; animation: bar 1s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -.3s; } .bars i:nth-child(3) { animation-delay: -.6s; } .bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes bar { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.name:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .07); color: var(--text);
}
.exp { display: inline-flex; align-items: center; gap: 5px; }
.exp::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.exp.soon { color: var(--warn); } .exp.soon::before { background: var(--warn); }
.exp.never::before { background: var(--accent); }

.exp-btn { background: none; border: 1px solid transparent; border-radius: 7px; padding: 1px 7px 1px 6px; margin-left: -6px; cursor: pointer; color: inherit; font-size: inherit; }
.exp.soon.exp-btn { color: var(--warn); }
.exp-btn:hover { background: var(--hover); border-color: var(--line); color: var(--text); }
.exp-btn::after { content: "▾"; font-size: 10px; opacity: .6; margin-left: 2px; }
.menu {
  position: absolute; z-index: 45; min-width: 210px; padding: 6px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--line2); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: fade .12s ease;
}
.menu-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 6px 10px 6px; }
.menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--hover); }

.player { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.track { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); cursor: pointer; position: relative; }
.track:hover { height: 7px; }
.fill { height: 100%; width: 0; border-radius: inherit; background: var(--grad); }
.time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }

.acts { display: flex; gap: 2px; opacity: .65; transition: opacity .15s; }
.row:hover .acts { opacity: 1; }

.empty { color: var(--muted); text-align: center; padding: 56px 20px; }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 8px; }

/* ---------- visor ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 40px;
  background: rgba(5, 6, 9, .88); backdrop-filter: blur(8px); animation: fade .2s ease;
}
.lightbox img, .lightbox video { max-width: 100%; max-height: 85vh; border-radius: 12px; box-shadow: var(--shadow); }
.lightbox .close { position: absolute; top: 18px; right: 18px; }
.lightbox .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 13px; }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--line2); box-shadow: var(--shadow);
  animation: toastIn .25s ease;
}
.toast svg { color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 640px) {
  .row { gap: 11px; padding: 11px 12px; }
  .thumb { width: 48px; height: 48px; }
  .acts { opacity: 1; }
  .acts .icon-btn.hide-sm { display: none; }
}
