/* ============================================================
   MOMENTLY — Media platform components
   (dashboard / neutral language; consumes ds.css tokens)
   ============================================================ */

/* ---------- Stat tiles -------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); gap: 14px; }
.stat-tile {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 20px 22px;
}
.stat-tile .num { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1; letter-spacing: -0.01em; }
.stat-tile .lbl { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.stat-tile .trend { font-size: 12px; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.stat-tile .trend.up { color: var(--color-success); }

/* ---------- Tabs / segmented control ------------------------ */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: var(--radius-md);
}
.seg button {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text-2);
  background: transparent; border: none; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s;
}
.seg button .count { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button[aria-selected="true"] .count { color: var(--text-2); }

/* ---------- Upload dropzone -------------------------------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-xl);
  background: var(--surface); padding: 44px 32px; text-align: center;
  cursor: pointer; transition: border-color .18s, background .18s;
}
.dropzone.drag { border-color: var(--text); background: var(--surface-2); }
.dropzone .dz-ico {
  width: 56px; height: 56px; margin: 0 auto 18px; border-radius: var(--radius-lg);
  background: var(--surface-2); display: grid; place-items: center; color: var(--text-2);
}
.dropzone .dz-ico svg { width: 26px; height: 26px; }
.dropzone .dz-title { font-size: 17px; font-weight: 600; }
.dropzone .dz-title b { text-decoration: underline; text-underline-offset: 3px; }
.dropzone .dz-sub { font-size: 13px; color: var(--text-3); margin-top: 7px; }

/* ---------- Upload queue ----------------------------------- */
.upload-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.up-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); padding: 12px 14px;
}
.up-thumb { width: 40px; height: 40px; border-radius: 7px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); flex: none; }
.up-thumb svg { width: 18px; height: 18px; }
.up-main { min-width: 0; }
.up-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.up-bar { height: 5px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; margin-top: 9px; }
.up-bar > span { display: block; height: 100%; width: 0%; background: var(--ink-950); border-radius: inherit; transition: width .3s ease; }
[data-theme="dark"] .up-bar > span { background: var(--white); }
.up-row.done .up-bar > span { background: var(--color-success); }
.up-row.failed .up-bar > span { background: var(--color-danger); width: 100% !important; }
.up-status { font-size: 12px; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.up-row.done .up-status { color: var(--color-success); }
.up-row.failed .up-status { color: var(--color-danger); }
.up-x { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.up-x:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Storage meter ---------------------------------- */
.storage { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 20px 22px; max-width: 380px; }
.storage .s-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.storage .s-title { font-size: 14px; font-weight: 600; }
.storage .s-val { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); }
.storage .s-track { height: 8px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.storage .s-fill { height: 100%; border-radius: inherit; background: var(--ink-950); }
[data-theme="dark"] .storage .s-fill { background: var(--white); }
.storage.warn .s-fill { background: var(--color-warning); }
.storage .s-note { font-size: 12px; color: var(--text-3); margin-top: 10px; }
.storage.warn .s-note { color: var(--color-warning); }

/* ---------- Media gallery ---------------------------------- */
.gallery-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.batchbar {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-full);
  background: var(--surface); padding: 7px 8px 7px 16px; box-shadow: var(--shadow-sm);
  opacity: .45; pointer-events: none; transition: opacity .2s;
}
.batchbar.on { opacity: 1; pointer-events: auto; }
.batchbar .bcount { font-size: 13px; font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.tile {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  aspect-ratio: 1 / 1; background: var(--surface-2); cursor: pointer;
  border: 1px solid var(--border);
  transition: transform .12s, box-shadow .12s;
}
.tile:hover { box-shadow: var(--shadow-md); }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-family: var(--font-display); font-size: 26px; }
.tile.video .ph::after,
.tile.audio .ph::after { content: none; }
/* type badge */
.tile .tbadge {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(10,10,10,.72); color: #fff; backdrop-filter: blur(4px);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: var(--radius-full);
  display: flex; align-items: center; gap: 5px;
}
.tile .tbadge svg { width: 11px; height: 11px; }
/* play overlay for video */
.tile.video .play-ov {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
}
.tile.video .play-ov span {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: grid; place-items: center;
}
.tile.video .play-ov span::after { content: ""; width: 0; height: 0; border-left: 13px solid var(--ink-950); border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 3px; }
/* waveform for audio tile */
.tile.audio .wave { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3px; z-index: 1; }
.tile.audio .wave i { width: 3px; background: var(--text-3); border-radius: 2px; display: block; }
/* selection */
.tile .sel {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(10,10,10,.35);
  display: grid; place-items: center; opacity: 0; transition: opacity .15s;
}
.tile:hover .sel { opacity: 1; }
.tile .sel svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.tile.selected .sel { opacity: 1; background: var(--ink-950); border-color: var(--ink-950); }
[data-theme="dark"] .tile.selected .sel { background: var(--white); border-color: var(--white); }
.tile.selected .sel svg { opacity: 1; }
[data-theme="dark"] .tile.selected .sel svg { color: var(--ink-950); }
.tile.selected { outline: 2px solid var(--ink-950); outline-offset: 2px; }
[data-theme="dark"] .tile.selected { outline-color: var(--white); }

/* ---------- Video player ----------------------------------- */
.player {
  border-radius: var(--radius-lg); overflow: hidden; background: #0A0A0A;
  position: relative; aspect-ratio: 16 / 9; max-width: 620px;
}
.player .stage { position: absolute; inset: 0; display: grid; place-items: center; }
.player .stage .bigplay {
  width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: grid; place-items: center; cursor: pointer; transition: transform .12s;
}
.player .stage .bigplay:hover { transform: scale(1.06); }
.player .stage .bigplay::after { content: ""; width: 0; height: 0; border-left: 20px solid #0A0A0A; border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 5px; }
.player.playing .bigplay { opacity: 0; pointer-events: none; }
.player .watermark { position: absolute; top: 14px; left: 16px; color: rgba(255,255,255,.5); font-family: var(--font-display); font-size: 18px; z-index: 2; }
.player .controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 9px;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
}
.player .scrub { height: 4px; border-radius: var(--radius-full); background: rgba(255,255,255,.25); cursor: pointer; }
.player .scrub > span { display: block; height: 100%; width: 28%; background: #fff; border-radius: inherit; position: relative; }
.player .scrub > span::after { content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.player .crow { display: flex; align-items: center; gap: 14px; color: #fff; }
.player .crow .pp { cursor: pointer; width: 18px; display: grid; place-items: center; }
.player .crow .pp svg { width: 16px; height: 16px; }
.player .crow .time { font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,.85); }
.player .crow .spacer { flex: 1; }
.player .crow .cbtn { cursor: pointer; opacity: .85; }
.player .crow .cbtn:hover { opacity: 1; }
.player .crow .cbtn svg { width: 16px; height: 16px; display: block; }

/* ---------- Voicemail / audio player ----------------------- */
.voiceplayer {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 16px 18px; max-width: 460px;
}
.vp-top { display: flex; align-items: center; gap: 14px; }
.vp-play { width: 44px; height: 44px; border-radius: 50%; background: var(--ink-950); display: grid; place-items: center; cursor: pointer; flex: none; }
[data-theme="dark"] .vp-play { background: var(--white); }
.vp-play .tri { width: 0; height: 0; border-left: 12px solid var(--white); border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 3px; }
[data-theme="dark"] .vp-play .tri { border-left-color: var(--ink-950); }
.vp-play.playing .tri { width: 12px; height: 14px; border: none; background: none; margin: 0; position: relative; }
.vp-play.playing .tri::before, .vp-play.playing .tri::after { content: ""; position: absolute; top: 0; width: 4px; height: 14px; background: var(--white); border-radius: 1px; }
[data-theme="dark"] .vp-play.playing .tri::before, [data-theme="dark"] .vp-play.playing .tri::after { background: var(--ink-950); }
.vp-play.playing .tri::before { left: 0; } .vp-play.playing .tri::after { right: 0; }
.vp-wave { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 2px; height: 36px; }
.vp-wave i { flex: 1; background: var(--ink-300); border-radius: 2px; min-width: 2px; transition: background .2s; }
.vp-wave i.played { background: var(--ink-950); }
[data-theme="dark"] .vp-wave i { background: var(--ink-700); }
[data-theme="dark"] .vp-wave i.played { background: var(--white); }
.vp-dur { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); flex: none; }
.vp-transcript { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--text-2); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.vp-transcript .lbl { color: var(--text-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 6px; }

/* ---------- QR card ---------------------------------------- */
.qr-card {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 24px; max-width: 520px;
}
.qr-code { width: 132px; height: 132px; background: #fff; border-radius: var(--radius-md); padding: 10px; border: 1px solid var(--border); flex: none; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-info { min-width: 0; }
.qr-info .qr-label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.qr-info .qr-link {
  font-family: var(--font-mono); font-size: 15px; font-weight: 500; margin: 8px 0 4px;
  background: var(--surface-2); padding: 7px 12px; border-radius: var(--radius-md); display: inline-block; cursor: pointer;
}
.qr-info .qr-scan { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.qr-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Empty state ------------------------------------ */
.empty {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 52px 32px; text-align: center;
}
.empty .e-art { width: 96px; height: 96px; margin: 0 auto 22px; }
.empty .e-art svg { width: 100%; height: 100%; }
.empty .e-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.empty .e-sub { font-size: 15px; color: var(--text-2); margin: 10px auto 22px; max-width: 360px; }

/* ---------- icon button ------------------------------------ */
.iconbtn {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 16px; height: 16px; }

@media (max-width: 880px) {
  .qr-card { justify-content: center; }
}
