/* vault.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

:root {
  --bg:       #0f0f0f;
  --surface:  #181818;
  --surface2: #222222;
  --border:   #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #777;
  --accent:   #286d00;
  --accent2:  #3a9900;
  --danger:   #c00;
  --sidebar-w: 220px;
  --header-h:  52px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Login ───────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem;
  width: 340px;
  text-align: center;
}
.login-logo { font-size: 2.5rem; margin-bottom: 0.75rem; }
.login-box h1 { font-size: 1.2rem; font-weight: 600; margin-bottom: 1.5rem; color: var(--text); }
.alert-error {
  background: rgba(200,0,0,0.15);
  border: 1px solid rgba(200,0,0,0.3);
  color: #f88;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}
.form-group { margin-bottom: 1rem; text-align: left; }
.form-group label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6em 0.8em;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--accent2); }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.7em;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent2); }

/* ── Header ──────────────────────────────────────────────────── */
.vault-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 0.5rem; }
.vault-icon { font-size: 1.1rem; }
.vault-name { font-weight: 600; font-size: 0.9rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.user-badge { font-size: 0.8rem; color: var(--muted); }
.logout-link { font-size: 0.8rem; color: var(--muted); text-decoration: none; }
.logout-link:hover { color: var(--text); }

/* ── Shell ───────────────────────────────────────────────────── */
.vault-shell {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.vault-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-nav { padding: 0.75rem 0; }
.nav-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--text); font-weight: 500; }

.upload-zone {
  border-top: 1px solid var(--border);
  padding: 1rem;
}
.upload-inner {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.25rem 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-inner:hover, .upload-zone.drag-over .upload-inner {
  border-color: var(--accent2);
  background: rgba(40,109,0,0.08);
}
.upload-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.upload-inner p { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }

.mkdir-form { border-top: 1px solid var(--border); padding: 0.75rem; }
.mkdir-row { display: flex; gap: 0.4rem; }
.mkdir-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.4em 0.6em;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  min-width: 0;
}
.mkdir-input:focus { outline: none; border-color: var(--accent2); }
.mkdir-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  width: 30px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}
.mkdir-btn:hover { background: var(--accent); border-color: var(--accent); }

/* ── Main ────────────────────────────────────────────────────── */
.vault-main {
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
}

/* ── Breadcrumbs ─────────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}
.crumb-link { color: var(--muted); text-decoration: none; }
.crumb-link:hover { color: var(--text); }
.crumb-sep { color: var(--border); }
.crumb-current { color: var(--text); font-weight: 500; }

/* ── File grid ───────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
  position: relative;
}
.file-card:hover { border-color: #444; }

.file-card-inner {
  display: flex;
  flex-direction: column;
  padding: 0.875rem 0.75rem 0.75rem;
  height: 100%;
  text-decoration: none;
  color: var(--text);
}
a.file-card-inner:hover { color: var(--text); }

.file-icon { font-size: 2rem; margin-bottom: 0.5rem; line-height: 1; }

.file-thumb-link { display: block; }
.file-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  background: var(--surface2);
}

.file-meta { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.file-name { font-size: 0.8rem; font-weight: 500; word-break: break-word; }
.file-date, .file-size { font-size: 0.7rem; color: var(--muted); }

.file-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.file-card:hover .file-actions { opacity: 1; }

.action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25em 0.5em;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-family: inherit;
  transition: background 0.1s;
}
.action-btn:hover { background: #333; }
.action-btn.danger:hover { background: var(--danger); border-color: var(--danger); }
.inline-form { display: inline; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-dir {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--muted);
}
.empty-dir p { margin-bottom: 0.5rem; }
.empty-hint { font-size: 0.85rem; }

/* ── Upload progress ─────────────────────────────────────────── */
.upload-progress {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 240px;
  z-index: 200;
  display: none;
}
.upload-progress.visible { display: block; }
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent2);
  transition: width 0.2s;
}
