/* MyVault styles. Tailwind handles layout; this file handles theme + components.
   Colors are CSS variables: dark is the default, html.light overrides them. */
:root {
  --bg: #0a0a10;
  --surface: #14141e;
  --surface-2: #1c1c29;
  --border: #272738;
  --text: #f3f3f8;
  --muted: #8f8fa8;
  --accent: #ff6a3d;
  --accent-2: #ff9a5c;
  --danger: #ef4444;
  --ok: #22c55e;
  --glow: rgba(255, 106, 61, .16);
}
html.light {
  --bg: #f4f4f8;
  --surface: #ffffff;
  --surface-2: #eeeef4;
  --border: #e0e0ea;
  --text: #15151e;
  --muted: #6a6a82;
  --glow: rgba(255, 106, 61, .10);
}

html { color-scheme: dark; }
html.light { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-image: radial-gradient(900px 400px at 70% -100px, var(--glow), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
.text-muted { color: var(--muted); }
.link { color: var(--accent); font-weight: 700; }
.link:hover { text-decoration: underline; }
.back-link:hover { color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout pieces ---------- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); }
.topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px var(--glow); }
.logo-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.side-note { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }

.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; color: var(--muted); font-weight: 600; transition: .15s; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }

.bottom-nav { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); }
.bn-item.is-active { color: var(--accent); }
.bn-upload .bn-ic { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; margin-top: -16px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px var(--glow); }
.bn-upload { color: var(--text); }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 12px; font-weight: 700; font-size: 14px; border: 1px solid transparent; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px var(--glow); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-danger-ghost { color: var(--danger); background: var(--surface); border-color: var(--border); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }

.label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.input { width: 100%; padding: 12px 16px; border-radius: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.file-input { padding: 8px 12px; font-size: 13px; }
textarea.input { resize: vertical; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: var(--muted); background: transparent; border: 0; cursor: pointer; transition: .15s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.i-moon { display: none; }
html.light .i-sun { display: none; }
html.light .i-moon { display: inline-flex; }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 800; color: #fff; border: 0; cursor: pointer; background: linear-gradient(135deg, var(--accent), #c026d3); }
.avatar.lg { width: 76px; height: 76px; font-size: 30px; cursor: default; }

/* ---------- Dropdown menus ---------- */
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }

/* ---------- Cards ---------- */
.vcard { transition: transform .2s; }
.vcard:hover { transform: translateY(-3px); }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.vcard:hover .thumb img { transform: scale(1.05); }
.thumb-default { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); background: linear-gradient(135deg, var(--surface-2), var(--surface)); }
.thumb-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; opacity: 0; background: rgba(0, 0, 0, .35); transition: opacity .2s; }
.vcard:hover .thumb-play { opacity: 1; }
.badge { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .75); }

.progress { height: 5px; border-radius: 99px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.progress.lg { height: 10px; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }

.stat { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.stat-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat-hint { font-size: 12px; color: var(--muted); }
.surface-box { padding: 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 20px; border: 2px dashed var(--border); border-radius: 24px; }
.empty-icon { color: var(--muted); }

/* ---------- Flash messages ---------- */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border-radius: 12px; font-size: 14px; font-weight: 600; border: 1px solid; }
.flash[hidden] { display: none; }
.flash button { background: none; border: 0; color: inherit; font-size: 20px; cursor: pointer; line-height: 1; }
.flash-success { color: #4ade80; background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .35); }
.flash-error { color: #f87171; background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); }
.flash-info { color: #60a5fa; background: rgba(59, 130, 246, .1); border-color: rgba(59, 130, 246, .35); }
html.light .flash-success { color: #15803d; }
html.light .flash-error { color: #b91c1c; }
html.light .flash-info { color: #1d4ed8; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px 28px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 60px rgba(0, 0, 0, .25); }

/* ---------- Upload ---------- */
.dropzone { display: flex; align-items: center; justify-content: center; min-height: 190px; padding: 24px; border-radius: 20px; border: 2px dashed var(--border); background: var(--surface); cursor: pointer; transition: .2s; }
.dropzone:hover, .dropzone.is-over, .dropzone:focus-visible { outline: none; border-color: var(--accent); background: var(--glow); }
.dropzone [hidden] { display: none; }
.chosen-thumb { position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 96px; height: 54px; overflow: hidden; border-radius: 10px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.chosen-thumb.lg { width: 128px; height: 72px; }
.chosen-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Player ---------- */
.player-wrap { position: relative; overflow: hidden; border-radius: 18px; background: #000; border: 1px solid var(--border); }
.player-wrap video { display: block; width: 100%; max-height: 78vh; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.resume { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.resume[hidden] { display: none; }
.resume-box { padding: 22px 26px; text-align: center; border-radius: 18px; color: var(--text); background: var(--surface); border: 1px solid var(--border); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
.modal-box { position: relative; width: 100%; max-width: 400px; padding: 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 70px rgba(0, 0, 0, .5); }
