*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --accent: #7c6af7;
  --accent-hover: #9b8dff;
  --text: #e2e4ef;
  --muted: #7a7d8e;
  --error: #e05555;
  --radius: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.logout-btn {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--muted); }

main { padding: 1.5rem; max-width: 960px; margin: 0 auto; }

/* ---- Login ---- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--accent);
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 1rem;
}
.login-card label:first-of-type { margin-top: 0; }

.login-card input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--accent); }

.login-card button {
  margin-top: 1.5rem;
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.login-card button:hover { background: var(--accent-hover); }

.error {
  color: var(--error);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* ---- Browser ---- */
.browser { padding-top: 0.5rem; }

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }

.browser h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

section + section { margin-top: 2rem; }

.item-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.item {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.1s;
}
.item:last-child { border-bottom: none; }

.item.folder a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.item.folder a:hover { color: var(--accent); }

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.icon { font-size: 1.1rem; flex-shrink: 0; }
.filename { flex: 1; min-width: 140px; font-size: 0.95rem; word-break: break-all; }
.size { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

.actions { display: flex; gap: 8px; flex-shrink: 0; }

.play-btn, .dl-btn {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s;
}
.play-btn {
  background: var(--accent);
  color: #fff;
}
.play-btn:hover { background: var(--accent-hover); }

.dl-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.dl-btn:hover { color: var(--text); border-color: var(--muted); }

/* ---- Media / image / pdf previews ---- */
.preview-wrap { padding: 0 14px 14px; }

.media-player {
  width: 100%;
  max-height: 480px;
  border-radius: 6px;
  background: #000;
  outline: none;
}

.img-preview {
  display: block;
  max-width: 100%;
  max-height: 600px;
  border-radius: 6px;
  object-fit: contain;
  background: #000;
}

.pdf-preview {
  width: 100%;
  height: 700px;
  border-radius: 6px;
  background: var(--bg);
}

.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

@media (max-width: 600px) {
  .file-row { gap: 8px; }
  .actions { flex-wrap: wrap; }
}
