/* ============================================================
   فضای ذخیره‌سازی من — Stylesheet
   Design: warm slate + amber-signal accent, Vazirmatn for Persian UI
   ============================================================ */

@import url('https://cdnjs.cloudflare.com/ajax/libs/vazirmatn-webfont/33.003/UI+Persian/Vazirmatn-UI-Persian.min.css');

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #edece7;
  --ink: #23211d;
  --ink-soft: #6b675e;
  --line: #e2e0d9;
  --accent: #b5502e;      /* burnt sienna — signal color for primary actions */
  --accent-ink: #ffffff;
  --accent-soft: #f3e0d6;
  --folder: #d9a441;      /* ochre for folders */
  --danger: #b3261e;
  --success: #2e7d4f;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(35, 33, 29, 0.06);
  --shadow-lg: 0 12px 40px rgba(35, 33, 29, 0.18);
  font-family: 'Vazirmatn UI', 'Vazirmatn', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
}
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #9c4326; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 8px 12px; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--folder));
  position: relative; flex-shrink: 0;
}
.brand-mark.small { width: 28px; height: 28px; border-radius: 8px; }
.brand-mark::after {
  content: ''; position: absolute; inset: 8px;
  border: 2px solid rgba(255,255,255,.85); border-radius: 4px;
}
.brand h1 { font-size: 20px; margin: 0; }

/* ---------- Install / Login shells ---------- */
.install-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.install-wrap { width: 100%; max-width: 480px; }
.install-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px; box-shadow: var(--shadow-lg);
}
.install-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.install-form h2 { font-size: 14px; color: var(--ink-soft); margin: 10px 0 -4px; font-weight: 600; }
.install-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.install-form input {
  padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 14px; font-family: inherit; background: var(--bg);
}
.install-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--ink-soft); font-size: 13px; }

.req-list { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; padding: 14px; background: var(--surface-2); border-radius: 10px; }
.req { font-size: 13px; }
.req.ok { color: var(--success); }
.req.bad { color: var(--danger); }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.alert-error { background: #fbe9e7; color: var(--danger); }
.alert-success { background: #e6f4ea; color: var(--success); }
.alert ul { padding-inline-start: 18px; list-style: disc; margin: 0; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 140px; }
.topbar-search { flex: 1; max-width: 520px; }
.topbar-search input {
  width: 100%; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface-2); font-family: inherit; font-size: 14px;
}
.topbar-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.username { font-size: 13px; color: var(--ink-soft); }

.body-wrap { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 220px; flex-shrink: 0; padding: 18px 14px; border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px; background: var(--surface);
}
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.side-link { padding: 9px 12px; border-radius: 8px; color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.side-link:hover { background: var(--surface-2); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.storage-hint { margin-top: auto; padding: 10px 4px; font-size: 12px; line-height: 1.6; }

.main { flex: 1; padding: 18px 24px; overflow-y: auto; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--line); }
.breadcrumb .current { font-weight: 700; }

.drop-zone { position: relative; min-height: 300px; border-radius: 12px; transition: background .15s; }
.drop-zone.drag-over { background: var(--accent-soft); outline: 2px dashed var(--accent); }

.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.file-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; text-align: center;
  transition: box-shadow .12s, border-color .12s;
  user-select: none;
}
.file-card:hover { box-shadow: var(--shadow); border-color: #cfcbc0; }
.file-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.file-icon { font-size: 34px; line-height: 1; }
.file-name { font-size: 12.5px; font-weight: 600; word-break: break-word; max-width: 100%; }
.file-meta { font-size: 11px; color: var(--ink-soft); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-icon { font-size: 42px; margin-bottom: 10px; }

.upload-progress { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.upload-progress .bar-track { height: 6px; background: var(--surface-2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.upload-progress .bar-fill { height: 100%; background: var(--accent); width: 0%; transition: width .15s; }

/* ---------- Context menu ---------- */
.ctx-menu {
  position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px; overflow: hidden;
}
.ctx-menu button {
  width: 100%; text-align: right; background: none; border: none; padding: 9px 12px; font-size: 13.5px;
  border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.ctx-menu button:hover { background: var(--surface-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(35,33,29,.45); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 14px; padding: 24px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--ink-soft); }
.modal-field input, .modal-field select, .modal-field textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); font-family: inherit; font-size: 14px; background: var(--bg);
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal textarea.editor { min-height: 320px; font-family: 'Courier New', monospace; direction: ltr; text-align: left; }
.tree-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.tree-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.tree-item:hover { background: var(--surface-2); }
.tree-item.selected { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.share-link-box { display: flex; gap: 8px; margin-top: 10px; }
.share-link-box input { flex: 1; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; direction: ltr; text-align: left; }

/* ---------- Shares view ---------- */
.shares-view table { width: 100%; border-collapse: collapse; font-size: 13px; }
.shares-view th, .shares-view td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.shares-view th { color: var(--ink-soft); font-weight: 600; font-size: 12px; }
.shares-view .link-cell { direction: ltr; text-align: left; font-size: 12px; color: var(--ink-soft); }

/* ---------- Public share page ---------- */
.share-title { margin: 10px 0 2px; font-size: 18px; }
.share-file-list { margin: 14px 0; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.share-file-list li { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.share-file-list li:last-child { border-bottom: none; }
.share-preview-img { width: 100%; border-radius: 10px; margin: 12px 0; }
.share-preview-media { width: 100%; margin: 12px 0; border-radius: 10px; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar-search { display: none; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
