/* Londoners Media — monochrome, minimal, luxury. */
:root {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --surface-2: #f5f5f5;
  --border: #e6e6e6;
  --border-2: #d9d9d9;
  --border-3: #d1d1d1;
  --text: #000000;
  --text-2: #3b3b3b;
  --muted: #7a7a7a;
  --muted-2: #9d9d9d;

  --success: #00c853; --success-bg: #e8f5e9; --success-fg: #166534;
  --error: #e53935;   --error-bg: #ffebee;   --error-fg: #991b1b;
  --warning: #ff9800; --warning-bg: #fff3e0; --warning-fg: #92400e;
  --pending: #f4f4f4; --pending-fg: #6b6b6b;

  --radius-btn: 10px;
  --radius-card: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --topbar-h: 64px;
  --sidebar-w: 286px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-btn);
  padding: 11px 18px; cursor: pointer; line-height: 1;
  transition: background .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #1c1c1c; }
.btn-primary:disabled { background: var(--border-3); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface); }
.btn-ghost.danger { color: var(--error); border-color: #f0c9c8; }
.btn-ghost.danger:hover { background: var(--error-bg); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; padding: 13px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-2);
  background: #fff; color: var(--text); font-size: 18px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.icon-btn:hover { background: var(--surface); }

/* ---------- Fields ---------- */
.field { display: block; text-align: left; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; text-transform: uppercase; }
input[type=text], input[type=password] {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }

/* ---------- Login ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: radial-gradient(120% 120% at 50% 0%, #fff 0%, #fafafa 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 36px 30px; text-align: center; }
.login-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 14px; }
.login-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card .field { margin-bottom: 18px; }
.login-error { color: var(--error); font-size: 13px; min-height: 18px; margin: 12px 0 0; }
.login-foot { color: var(--muted-2); font-size: 12px; }

/* ---------- Topbar ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-thin { font-weight: 400; color: var(--muted); }

/* ---------- Layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 0; }
.sidebar { border-right: 1px solid var(--border); padding: 18px 14px; overflow-y: auto; background: var(--bg); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 12px; }
.sidebar-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.new-folder { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.new-folder input { font-size: 14px; padding: 9px 11px; }
.new-folder-hint { font-size: 12px; color: var(--muted); margin: 8px 2px; }
.new-folder-hint code { color: var(--text-2); }
.new-folder-actions { display: flex; gap: 8px; }

.folder-list { display: flex; flex-direction: column; gap: 2px; }
.folder-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .12s; border: 1px solid transparent; }
.folder-item:hover { background: var(--surface); }
.folder-item.active { background: var(--text); }
.folder-item.active .folder-item-name,
.folder-item.active .folder-item-count { color: #fff; }
.folder-item-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-item-count { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; min-width: 24px; text-align: center; }
.folder-item.active .folder-item-count { background: rgba(255,255,255,.18); }

/* ---------- Main ---------- */
.main { overflow-y: auto; padding: 26px 30px 60px; }
.main-empty { height: 70%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); gap: 6px; }
.main-empty-logo { width: 70px; height: 70px; object-fit: contain; opacity: .5; margin-bottom: 10px; }
.main-empty h2 { color: var(--text); margin: 0; font-size: 20px; }
.main-empty p { margin: 0; max-width: 360px; }

.folder-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.folder-bar-left { display: flex; align-items: baseline; gap: 12px; }
.folder-title { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.folder-count { color: var(--muted); font-size: 14px; }
.folder-bar-right { display: flex; align-items: center; gap: 8px; }

.dropzone { border: 1.5px dashed var(--border-2); border-radius: var(--radius-card); padding: 26px; text-align: center; color: var(--muted); margin-bottom: 22px; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--text); background: var(--surface); color: var(--text); }
.dropzone-inner p { margin: 4px 0; font-size: 14px; }
.dropzone-icon { font-size: 26px; opacity: .5; margin-bottom: 6px; }

/* ---------- File grid ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.grid-empty { color: var(--muted); text-align: center; padding: 40px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .18s, transform .18s; display: flex; flex-direction: column; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-thumb { position: relative; aspect-ratio: 16/10; background: var(--surface-2); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 13px; }
.card-kind { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; letter-spacing: .03em; }
.play-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.play-badge span { width: 46px; height: 46px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; padding-left: 3px; }

/* processing overlay */
.card-progress { position: absolute; inset: 0; background: rgba(255,255,255,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text); }
.card-progress .pct { font-size: 20px; font-weight: 700; }
.card-progress .lbl { font-size: 12px; color: var(--muted); }
.progress-track { width: 70%; height: 6px; border-radius: 999px; background: var(--border-2); overflow: hidden; }
.progress-fill { height: 100%; background: var(--text); border-radius: 999px; transition: width .4s ease; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--border-2); border-top-color: var(--text); border-radius: 999px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.card-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }

.pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.pill.ready { background: var(--success-bg); color: var(--success-fg); }
.pill.processing { background: var(--warning-bg); color: var(--warning-fg); }
.pill.queued { background: var(--pending); color: var(--pending-fg); }
.pill.failed { background: var(--error-bg); color: var(--error-fg); }
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 2px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.act { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; transition: background .12s, color .12s; }
.act:hover { background: var(--surface); color: var(--text); }
.act.danger:hover { background: var(--error-bg); color: var(--error); }

/* ---------- Upload dock ---------- */
.upload-dock { position: fixed; right: 22px; bottom: 22px; width: 340px; max-height: 60vh; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; display: flex; flex-direction: column; overflow: hidden; }
.dock-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.dock-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dock-item { padding: 9px 10px; border-radius: 10px; background: var(--surface); }
.dock-item-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.dock-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dock-item-status { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.dock-bar { height: 5px; border-radius: 999px; background: var(--border-2); margin-top: 7px; overflow: hidden; }
.dock-bar > span { display: block; height: 100%; background: var(--text); width: 0; transition: width .3s; }
.dock-item.done .dock-bar > span { background: var(--success); }
.dock-item.error .dock-item-status { color: var(--error); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; padding: 24px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.modal .field { margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* preview lightbox */
.preview { background: transparent; box-shadow: none; max-width: min(1000px, 94vw); width: auto; padding: 0; text-align: center; }
.preview video, .preview img { max-width: 100%; max-height: 78vh; border-radius: 12px; background: #000; display: block; box-shadow: var(--shadow-lg); }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: #fff; }
.preview-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-bar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.preview-bar .btn-ghost:hover { background: rgba(255,255,255,.12); }

.move-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 18px; }
.move-opt { text-align: left; padding: 11px 14px; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; font-weight: 500; transition: background .12s, border-color .12s; }
.move-opt:hover { background: var(--surface); }
.move-opt.current { opacity: .5; cursor: default; }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--text); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); animation: slidein .2s ease; max-width: 320px; }
.toast.success { background: #0c7a3b; }
.toast.error { background: var(--error); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
  .main { padding: 20px 16px 50px; }
  .upload-dock { left: 12px; right: 12px; width: auto; }
}
