/* DenDrive UI. Dark DENDAT theme, no external assets. */
:root {
  --bg: #0d1117;
  --bg2: #131a24;
  --bg3: #1a2332;
  --border: #263042;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4f8cff;
  --accent-dim: rgba(79, 140, 255, .14);
  --danger: #ff5d5d;
  --ok: #3fb96b;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ── layout ─────────────────────────────────────────────── */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; padding: 18px 14px;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; padding: 2px 6px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* ── buttons ────────────────────────────────────────────── */
.btn-new {
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: 11px 0; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-new:hover { filter: brightness(1.1); }
.btn-primary {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  border-radius: var(--radius); padding: 10px 18px; font-size: 14px;
  font-weight: 600; cursor: pointer; text-align: center;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.icon-btn {
  background: none; border: 0; color: var(--muted); font-size: 17px;
  cursor: pointer; padding: 6px 9px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }

/* ── nav ────────────────────────────────────────────────── */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.storage-meter { margin-top: auto; padding: 6px; }
.meter-bar { height: 6px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s; }
.meter-fill.warn { background: #e8a13c; }
.meter-fill.full { background: var(--danger); }
.meter-text { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ── topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px; border-bottom: 1px solid var(--border);
}
.search-wrap { flex: 1; max-width: 560px; }
.search-wrap input {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 22px; padding: 9px 18px;
  font-size: 14px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-chip {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 16px;
  padding: 5px 12px; font-size: 12.5px; color: var(--muted);
}

/* ── breadcrumb bar ─────────────────────────────────────── */
.crumb-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 6px;
}
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 15px; }
.breadcrumb a { color: var(--muted); padding: 3px 7px; border-radius: 6px; }
.breadcrumb a:hover { background: var(--bg3); color: var(--text); }
.breadcrumb .cur { color: var(--text); font-weight: 600; padding: 3px 7px; }
.breadcrumb .sep { color: var(--border); }
.crumb-actions { display: flex; gap: 8px; }

/* ── content ────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 12px 22px 40px; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px; overflow: hidden;
}
.card:hover { border-color: var(--accent); }
.card .ic { font-size: 20px; flex-shrink: 0; }
.card .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.card .sub { font-size: 11.5px; color: var(--muted); }
.card .meta { min-width: 0; }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
}
.row:hover { background: var(--bg2); }
.row .ic { width: 24px; text-align: center; }
.row .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sz, .row .dt { width: 110px; color: var(--muted); font-size: 12.5px; text-align: right; }

.src-badge {
  display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 8px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; vertical-align: 2px;
  background: rgba(79, 140, 255, .16); color: var(--accent);
}
.src-badge.ccd { background: rgba(124, 92, 255, .16); color: #a68bff; }

.empty { text-align: center; color: var(--muted); padding: 70px 0 30px; }
.empty .big { font-size: 42px; margin-bottom: 12px; }

/* ── drag-drop ──────────────────────────────────────────── */
.dropzone {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(13, 17, 23, .82); border: 2px dashed var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--accent); pointer-events: none;
}

/* ── context menu ───────────────────────────────────────── */
.ctx {
  position: fixed; z-index: 100; min-width: 180px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.ctx button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  color: var(--text); padding: 8px 12px; border-radius: 7px; font-size: 13.5px; cursor: pointer;
}
.ctx button:hover { background: var(--accent-dim); }
.ctx button.danger { color: var(--danger); }
.ctx hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

/* ── modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
}
.modal.wide { max-width: 900px; }
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal input[type=text], .modal input[type=number], .modal input[type=email], .modal select {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; outline: none; margin-bottom: 12px;
}
.modal input:focus, .modal select:focus { border-color: var(--accent); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal .share-url {
  display: flex; gap: 8px; margin: 10px 0;
}
.modal .share-url input { flex: 1; margin: 0; }
.preview-frame { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: #000; }
.preview-img { max-width: 100%; max-height: 68vh; display: block; margin: 0 auto; border-radius: 8px; }
.preview-text {
  width: 100%; height: 60vh; overflow: auto; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  font: 12.5px/1.5 ui-monospace, "Cascadia Code", Menlo, monospace; white-space: pre-wrap;
}

/* ── toasts ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 11px 16px; min-width: 260px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast .tp { height: 4px; background: var(--bg); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.toast .tp > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ── activity view ──────────────────────────────────────── */
.act-row { display: flex; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.act-row .a { color: var(--accent); width: 110px; flex-shrink: 0; }
.act-row .t { flex: 1; }
.act-row .d { color: var(--muted); }

/* ── login page ─────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(1200px 600px at 50% -100px, #16233a, var(--bg)); }
.login-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  padding: 42px 38px; width: 100%; max-width: 400px; text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.login-logo h1 { font-size: 26px; }
.login-sub { color: var(--muted); margin-bottom: 26px; }
.login-btn { display: block; width: 100%; padding: 12px; font-size: 15px; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 14px; }
.login-error {
  background: rgba(255, 93, 93, .1); border: 1px solid var(--danger); color: var(--danger);
  border-radius: 8px; padding: 10px; font-size: 13px; margin-bottom: 16px;
}
.dev-login { margin-top: 26px; border-top: 1px dashed var(--border); padding-top: 18px; }
.dev-login input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 10px; outline: none;
}
.dev-tag { font-size: 11px; color: #e8a13c; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.share-file { margin: 18px 0 22px; }
.share-name { font-size: 17px; font-weight: 600; word-break: break-all; }
.share-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .row .dt { display: none; }
}
