/* hyperVisorRecord — tema oscuro profesional, responsive */

:root {
  --bg: #0f1115;
  --bg-elev: #161a21;
  --bg-hover: #1c212b;
  --border: #262b33;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --text-faint: #6b7482;
  --accent: #4f8cff;
  --accent-hover: #3a74e0;
  --danger: #e5534b;
  --ok: #3fb950;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.icon { width: 22px; height: 22px; display: block; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* -------------------------------------------------------------- topbar ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: none;
}

.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: 0.2px; }
.brand-sub { color: var(--text-dim); font-size: 12.5px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.health {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.health.ok  { color: var(--ok); border-color: rgba(63, 185, 80, 0.35); }
.health.err { color: var(--danger); border-color: rgba(229, 83, 75, 0.4); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.btn-trash {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
}
.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* -------------------------------------------------------------- layout ---- */

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.app-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;   /* móvil: lista arriba, player fijo abajo */
  gap: 16px;
}
.app-view[hidden] { display: none; }

.list-pane {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.list-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.list-toolbar input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
}
.list-toolbar input:focus { outline: none; border-color: var(--accent); }
.list-toolbar input[type="date"] { flex: 0 0 150px; }
.list-toolbar input::placeholder { color: var(--text-faint); }

.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-tool .icon { width: 19px; height: 19px; }
.btn-tool:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-faint); }
.btn-tool:disabled { opacity: 0.4; cursor: default; }
.btn-tool:disabled:hover { background: var(--bg); color: var(--text-dim); border-color: var(--border); }
.btn-tool-danger:hover:not(:disabled) { color: var(--danger); border-color: rgba(229, 83, 75, 0.5); }

.select-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.select-bar[hidden], .list-toolbar[hidden] { display: none; }

.sel-count {
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.sel-spacer { flex: 1; }

.btn-tool.spinning .icon { animation: hyper-spin 0.9s linear infinite; }
@keyframes hyper-spin { to { transform: rotate(360deg); } }

.rec-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.rec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.rec-item:hover { background: var(--bg-hover); }
.rec-item.active {
  background: rgba(79, 140, 255, 0.12);
  border-color: rgba(79, 140, 255, 0.35);
}
.rec-item.selected {
  background: rgba(79, 140, 255, 0.18);
  border-color: rgba(79, 140, 255, 0.55);
}
.rec-item .icon-clock { color: var(--text-faint); flex: none; }

.rec-check { display: none; flex: none; }
.list-pane.select-mode .rec-check { display: flex; }
.rec-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.rec-times { display: flex; flex-direction: column; min-width: 0; }
.rec-range { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-dur { color: var(--text-dim); font-size: 12.5px; }

.empty { color: var(--text-faint); text-align: center; padding: 24px 12px; margin: 0; }

/* ------------------------------------------------------------ player ------ */

.player-pane {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow-y: auto;
}

.now { min-height: 44px; }
.now-title { font-size: 16px; font-weight: 650; }
.now-meta { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.timeline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timeline .t {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--text-dim);
  min-width: 40px;
  text-align: center;
}
.timeline input[type="range"] { flex: 1; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Desktop: las filas son transparentes al layout -> 7 botones en una fila */
.ctrl-row { display: contents; }

.ctrl {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.ctrl:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.ctrl:active { transform: scale(0.94); }
.ctrl:disabled { opacity: 0.35; cursor: default; }

.ctrl-play {
  width: 58px;
  height: 58px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ctrl-play:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.ctrl-lbl {
  position: absolute;
  bottom: 5px;
  font-size: 9px;
  font-weight: 700;
  color: inherit;
  letter-spacing: 0.3px;
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.icon-vol { width: 18px; height: 18px; color: var(--text-dim); }
.vol-row input[type="range"] { flex: 1; max-width: 220px; }

.btn-rate {
  flex: none;
  min-width: 52px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn-rate:hover { background: var(--bg-hover); border-color: var(--text-faint); }

/* --------------------------------------------------------------- papelera --- */

.trash-pane {
  grid-column: 1 / -1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.trash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.trash-head h2 { margin: 0; font-size: 16px; font-weight: 650; }

.trash-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.trash-note {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
  flex: none;
}

/* --------------------------------------------------------------- toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: 90vw;
  z-index: 50;
}

/* --------------------------------------------------------------- login ---- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}
.login-card .brand-mark { width: 44px; height: 44px; color: var(--accent); }
.login-card h1 { margin: 12px 0 0; font-size: 19px; font-weight: 650; }
.login-sub { margin: 2px 0 22px; color: var(--text-dim); font-size: 13px; }

.login-form { text-align: left; }
.login-form label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  margin-bottom: 14px;
}
.login-field .icon { width: 18px; height: 18px; color: var(--text-faint); }
.login-field input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  padding: 11px 0;
  font-size: 15px;
}
.login-field input:focus { outline: none; }
.login-field:focus-within { border-color: var(--accent); }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-primary:hover { background: var(--accent-hover); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: -6px 0 12px;
  text-align: center;
}

/* ------------------------------------------------------------ responsive -- */

@media (min-width: 860px) {
  .app-view {
    grid-template-columns: 340px 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (max-width: 859px) {
  .topbar { padding: 10px 12px; }
  .layout { padding: 12px; }
  .app-view { gap: 12px; }
  /* Dos filas: transporte (prev/play/next) arriba, ±10/±30 abajo */
  .controls { flex-direction: column; gap: 8px; }
  .ctrl-row { display: flex; justify-content: center; gap: 8px; }
  .ctrl { width: 44px; height: 44px; }
  .ctrl-play { width: 54px; height: 54px; }
  .list-toolbar { flex-wrap: wrap; }
  .list-toolbar input[type="date"] { flex: 1 1 100%; }
  .btn-tool { min-width: 34px; height: 34px; padding: 0 8px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .layout { padding: 8px; }
  .app-view { gap: 8px; }
  .player-pane { padding: 12px; gap: 10px; }
  .now { display: none; }
}
