/* Drive page — Google Drive style layout using the admin's colours.
   Every class starts with "dv-" so nothing here can affect other pages. */

.dv-root {
  display: grid;
  grid-template-columns: 236px 1fr;
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.dv-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Left column ─────────────────────────────────────────────── */
.dv-side {
  display: flex; flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  min-height: 0; overflow-y: auto;
}
.dv-new-btn {
  display: inline-flex; align-items: center; gap: 10px;
  align-self: flex-start;
  padding: 14px 22px 14px 16px;
  margin: 0 0 16px 4px;
  background: var(--panel);
  border-radius: 16px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 1px 2px rgba(11,15,9,0.18), 0 2px 6px rgba(11,15,9,0.08);
  transition: box-shadow 120ms, background 120ms;
}
.dv-new-btn:hover { background: var(--brand); color: var(--brand-ink); box-shadow: 0 2px 4px rgba(11,15,9,0.18), 0 4px 12px rgba(11,15,9,0.12); }

.dv-nav { display: flex; flex-direction: column; gap: 2px; }
.dv-nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  transition: background 100ms;
}
.dv-nav-item:hover { background: var(--bg-2); }
.dv-nav-item.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.dv-nav-item.drop-target { background: var(--cobalt-soft); outline: 2px solid var(--cobalt); }

.dv-storage { margin-top: auto; padding: 16px 12px 4px; border-top: 1px solid var(--line); }
.dv-storage-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 8px; color: var(--ink-2); }
.dv-storage-bar { height: 4px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.dv-storage-bar span { display: block; height: 100%; background: var(--cobalt); border-radius: 4px; }
.dv-storage-text { font-size: 13px; color: var(--ink-2); }
.dv-storage-sub { font-size: 11.5px; color: var(--ink-mute); margin-top: 3px; }

/* ── Main column ─────────────────────────────────────────────── */
.dv-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.dv-search {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 20px 4px;
  padding: 0 8px 0 16px;
  height: 46px;
  max-width: 720px;
  background: var(--bg);
  border-radius: 999px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  transition: background 120ms, box-shadow 120ms;
}
.dv-search:focus-within { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
.dv-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; color: var(--ink); min-width: 0; }

.dv-header, .dv-selbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px 8px 20px;
  min-height: 56px;
}
/* The selection bar and the summary share one fixed-height row, so the list doesn't jump */
.dv-selbar { margin: 0 16px 6px; padding: 0 8px; height: 44px; min-height: 44px; background: var(--cobalt-soft); border-radius: 999px; }
.dv-summary { margin: 0 16px 6px; padding: 0 12px; height: 44px; display: flex; align-items: center; font-size: 13px; color: var(--ink-mute); }
.dv-sel-count { font-weight: 600; font-size: 14px; }
.dv-sel-actions { display: flex; align-items: center; gap: 2px; margin-left: 8px; }

.dv-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.dv-crumb {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: "Archivo", sans-serif;
  font-size: 20px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink-soft);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.dv-crumb:hover { background: var(--bg-2); }
.dv-crumb.now { color: var(--ink); }
.dv-crumb.drop-target { background: var(--cobalt-soft); outline: 2px solid var(--cobalt); }
.dv-crumb-sep { color: var(--ink-mute); flex-shrink: 0; }

.dv-header-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dv-tool-btn { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dv-tool-btn:hover { background: var(--bg-2); }
.dv-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; margin: 0 4px; }
.dv-seg button { padding: 6px 14px; color: var(--ink-soft); display: inline-flex; }
.dv-seg button + button { border-left: 1px solid var(--line-2); }
.dv-seg button.on { background: var(--brand); color: var(--brand-ink); }

.dv-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.dv-icon-btn:hover { background: rgba(11,15,9,0.07); color: var(--ink); }
.dv-icon-btn.on { background: var(--cobalt-soft); color: var(--cobalt); }

.dv-trash-note {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 20px 8px;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px; color: var(--ink-soft);
}
.dv-link-btn { color: var(--cobalt); font-weight: 700; font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.dv-link-btn:hover { background: var(--cobalt-soft); }

.dv-body { flex: 1; display: flex; min-height: 0; }
.dv-content { flex: 1; overflow: auto; padding: 4px 20px 96px; position: relative; min-width: 0; }

.dv-section-label { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 14px 4px 12px; }

/* Grid */
.dv-grid { display: grid; gap: 14px; }
.dv-grid-folders { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dv-grid-files { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.dv-folder-card {
  display: flex; align-items: center; gap: 14px;
  height: 48px;
  padding: 0 4px 0 16px;
  background: var(--bg);
  border-radius: 12px;
  cursor: default; user-select: none;
  transition: background 100ms;
}
.dv-folder-card:hover { background: var(--bg-2); }
.dv-card-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.dv-card-more { width: 30px; height: 30px; }

.dv-file-card {
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px 4px 8px;
  cursor: default; user-select: none;
  transition: background 100ms;
}
.dv-file-card:hover { background: var(--bg-2); }
.dv-file-card-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 6px 10px; }
.dv-file-thumb {
  height: 150px;
  margin: 0 4px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  display: flex; align-items: center; justify-content: center;
}
.dv-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dv-thumb-icon { opacity: 0.9; }
.dv-file-card-foot { display: flex; align-items: center; gap: 6px; padding: 8px 10px 0; font-size: 12px; color: var(--ink-mute); }
.dv-file-card-foot svg { color: var(--warn); flex-shrink: 0; }

.dv-folder-card.selected, .dv-file-card.selected { background: var(--cobalt-soft); }
.dv-folder-card.selected .dv-card-name, .dv-file-card.selected .dv-card-name { color: #0B3FB8; }
.dv-folder-card.drop-target { background: var(--cobalt-soft); outline: 2px solid var(--cobalt); }

.dv-star-mini { color: var(--warn); display: inline-flex; flex-shrink: 0; }

.dv-kind-badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px;
  color: #fff;
  font-family: "Archivo", sans-serif; font-weight: 800; line-height: 1;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

/* List */
.dv-table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.dv-table th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-2);
  padding: 0 8px; height: 44px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.dv-th-name { width: auto; }
.dv-th-owner { width: 130px; }
.dv-th-date { width: 130px; }
.dv-th-loc { width: 150px; }
.dv-th-size { width: 96px; }
.dv-th-act { width: 148px; }
/* When the file area gets narrow (small screen or Details panel open), drop the
   less important columns so the Name column always has room — like Google Drive */
.dv-content { container-type: inline-size; }
@container (max-width: 860px) { .dv-th-owner, .dv-table td.dv-col-owner { display: none; } }
@container (max-width: 720px) { .dv-th-loc, .dv-table td.dv-col-loc { display: none; } }
@container (max-width: 580px) { .dv-th-date, .dv-table td.dv-col-date { display: none; } }
.dv-th-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; padding: 4px 6px; margin-left: -6px; border-radius: 6px; }
.dv-th-btn:hover { background: var(--bg-2); }
.dv-table td { padding: 0 8px; height: 48px; border-bottom: 1px solid var(--line); user-select: none; overflow: hidden; }
.dv-table tbody tr { cursor: default; }
.dv-table tbody tr:hover td { background: var(--bg); }
.dv-table tbody tr.selected td { background: var(--cobalt-soft); }
.dv-table tbody tr.drop-target td { background: var(--cobalt-soft); box-shadow: inset 0 2px 0 var(--cobalt), inset 0 -2px 0 var(--cobalt); }
.dv-name-cell { display: flex; align-items: center; gap: 14px; font-weight: 600; min-width: 0; }
.dv-muted { color: var(--ink-soft); white-space: nowrap; text-overflow: ellipsis; }
.dv-loc { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.dv-row-actions { display: flex; justify-content: flex-end; gap: 0; opacity: 0; transition: opacity 80ms; }
.dv-table tbody tr:hover .dv-row-actions, .dv-table tbody tr.selected .dv-row-actions { opacity: 1; }
.dv-row-actions .dv-icon-btn { width: 32px; height: 32px; }

/* Empty / loading */
.dv-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 72px 24px; color: var(--ink-mute); }
.dv-empty-ico { width: 96px; height: 96px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--ink-mute); margin-bottom: 18px; }
.dv-empty-title { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -0.02em; }
.dv-empty-body { font-size: 14px; margin-top: 6px; max-width: 380px; line-height: 1.55; }
.dv-empty-actions { display: flex; gap: 10px; margin-top: 18px; }
.dv-loading { display: flex; align-items: center; gap: 10px; padding: 40px 8px; color: var(--ink-mute); }
.dv-spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: dv-spin 0.7s linear infinite; }
@keyframes dv-spin { to { transform: rotate(360deg); } }

/* Drag files from the computer */
.dv-content.dropping { background: rgba(44,107,255,0.04); }
.dv-drop-overlay {
  position: absolute; inset: 0;
  border: 2px solid var(--cobalt); border-radius: 12px;
  background: rgba(44,107,255,0.08);
  pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 40px;
}
.dv-drop-msg { display: inline-flex; align-items: center; gap: 10px; background: var(--cobalt); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); }

/* Details panel */
.dv-details { width: 320px; flex-shrink: 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.dv-det-head { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--line); }
.dv-det-title { flex: 1; font-weight: 700; font-size: 15px; }
.dv-det-body { overflow-y: auto; padding: 16px; }
.dv-det-preview { height: 170px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 18px; }
.dv-det-preview img { width: 100%; height: 100%; object-fit: contain; }
.dv-det-section { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.dv-det-row { margin-bottom: 14px; }
.dv-det-label { font-size: 12px; font-weight: 600; color: var(--ink-mute); margin-bottom: 2px; }
.dv-det-value { font-size: 13.5px; color: var(--ink-2); word-break: break-word; }
.dv-det-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 60px 24px; color: var(--ink-mute); font-size: 13px; }

/* ── Floating menu ───────────────────────────────────────────── */
.dv-menu {
  position: fixed; z-index: 300;
  min-width: 240px;
  background: var(--panel);
  border-radius: 10px;
  padding: 6px 0;
  box-shadow: 0 4px 8px rgba(11,15,9,0.12), 0 12px 32px -8px rgba(11,15,9,0.25);
  border: 1px solid var(--line);
}
.dv-menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 16px; font-size: 14px; text-align: left; color: var(--ink-2); }
.dv-menu-item:hover:not(:disabled) { background: var(--bg); }
.dv-menu-item:disabled { opacity: 0.4; cursor: default; }
.dv-menu-item.danger:hover { color: var(--danger); }
.dv-menu-ico { width: 18px; display: inline-flex; justify-content: center; color: var(--ink-soft); }
.dv-menu-label { flex: 1; }
.dv-menu-hint { font-size: 11px; color: var(--ink-mute); font-family: "JetBrains Mono", monospace; }
.dv-menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.dv-menu-title { font-size: 12px; font-weight: 600; color: var(--ink-mute); padding: 8px 16px 4px; }

/* ── Move dialog ─────────────────────────────────────────────── */
.dv-move-path { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; color: var(--ink-mute); }
.dv-move-crumb { padding: 4px 8px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.dv-move-crumb:hover { background: var(--bg-2); }
.dv-move-list { border: 1px solid var(--line); border-radius: 10px; max-height: 320px; min-height: 160px; overflow-y: auto; padding: 4px; }
.dv-move-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 8px; text-align: left; font-size: 14px; }
.dv-move-row:hover { background: var(--bg); }
.dv-move-row.blocked { opacity: 0.45; cursor: not-allowed; }
.dv-move-empty { padding: 28px 16px; text-align: center; color: var(--ink-mute); font-size: 13px; }
.btn.dv-disabled { opacity: 0.45; cursor: not-allowed; }
.btn.dv-danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.dv-danger-btn:hover { background: #be123c; }

/* ── Preview ─────────────────────────────────────────────────── */
.dv-preview {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(10,12,9,0.92);
  display: flex; flex-direction: column;
  color: #fff;
}
.dv-pv-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: linear-gradient(rgba(0,0,0,0.6), transparent); }
.dv-pv-name { flex: 1; font-size: 15px; font-weight: 600; }
.dv-pv-count { font-size: 12px; color: rgba(255,255,255,0.6); font-family: "JetBrains Mono", monospace; }
.dv-pv-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.dv-pv-btn:hover { background: rgba(255,255,255,0.12); }
.dv-pv-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 80px 32px; min-height: 0; }
.dv-pv-media { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.dv-pv-frame { width: min(1000px, 100%); height: 100%; border: none; background: #fff; border-radius: 4px; }
.dv-pv-text {
  width: min(1000px, 100%); height: 100%; margin: 0; overflow: auto;
  background: #fff; color: #1a1a1a; border-radius: 4px; padding: 24px;
  font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.dv-pv-audio { display: flex; flex-direction: column; align-items: center; gap: 24px; color: rgba(255,255,255,0.7); }
.dv-pv-audio audio { width: 420px; max-width: 80vw; }
.dv-pv-none { display: flex; flex-direction: column; align-items: center; gap: 10px; background: #2b2f2a; padding: 40px 56px; border-radius: 14px; text-align: center; }
.dv-pv-none-title { font-size: 18px; font-weight: 700; margin-top: 6px; }
.dv-pv-none-sub { font-size: 13px; color: rgba(255,255,255,0.65); margin-bottom: 10px; }
.dv-pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(0,0,0,0.45); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.dv-pv-nav:hover { background: rgba(0,0,0,0.75); }
.dv-pv-nav.left { left: 16px; }
.dv-pv-nav.right { right: 16px; }

/* ── Upload panel ────────────────────────────────────────────── */
.dv-uploads {
  position: fixed; right: 24px; bottom: 0; z-index: 240;
  width: 360px;
  background: var(--panel);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -2px 6px rgba(11,15,9,0.08), 0 8px 30px rgba(11,15,9,0.25);
  overflow: hidden;
}
.dv-up-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 18px; background: var(--ink); color: #fff; }
.dv-up-title { flex: 1; font-weight: 600; font-size: 14px; }
.dv-up-hbtn { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.dv-up-hbtn:hover { background: rgba(255,255,255,0.14); }
.dv-up-list { max-height: 280px; overflow-y: auto; }
.dv-up-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.dv-up-name { flex: 1; font-size: 13.5px; }
.dv-up-err { font-size: 11.5px; color: var(--danger); white-space: normal; }
.dv-up-state { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; position: relative; }
.dv-up-ok { width: 22px; height: 22px; border-radius: 50%; background: var(--success); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.dv-up-muted { font-size: 12px; color: var(--ink-mute); }
.dv-up-act { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.dv-up-act:hover { background: var(--bg); }
/* While uploading, show a progress ring; hovering the row swaps it for a cancel button */
.dv-ring { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--cobalt) calc(var(--p) * 1%), var(--line-2) 0); -webkit-mask: radial-gradient(circle, transparent 7px, #000 7.5px); mask: radial-gradient(circle, transparent 7px, #000 7.5px); }
.dv-up-cancel { display: none; }
.dv-up-row:hover .dv-ring { display: none; }
.dv-up-row:hover .dv-up-cancel { display: inline-flex; }

/* ── Snackbar (bottom centre, with Undo) ─────────────────────── */
.dv-snack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 245;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 10px 12px 18px;
  background: #1f2420; color: #fff;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  max-width: min(560px, calc(100vw - 32px));
}
.dv-snack-btn { color: var(--brand); font-weight: 800; padding: 6px 10px; border-radius: 6px; text-transform: uppercase; font-size: 13px; letter-spacing: 0.04em; }
.dv-snack-btn:hover { background: rgba(255,255,255,0.08); }
.dv-snack-x { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.7); }
.dv-snack-x:hover { background: rgba(255,255,255,0.1); }

/* ── Smaller screens ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dv-details { position: absolute; right: 0; top: 0; bottom: 0; z-index: 5; box-shadow: var(--shadow-lg); }
}
@media (max-width: 820px) {
  .dv-root { grid-template-columns: 1fr; }
  .dv-side { flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .dv-new-btn { margin: 0; padding: 10px 16px; }
  .dv-nav { flex-direction: row; }
  .dv-nav-item { padding: 8px 12px; white-space: nowrap; }
  .dv-storage { display: none; }
  .dv-uploads { right: 8px; width: calc(100vw - 16px); }
}
