/* ═══════════════════════════════════════════════
   مرکز دانلود — استایل صفحه اصلی
   سبک: لایت مینیمال (Notion / Apple)
   ═══════════════════════════════════════════════ */

/* ─── فونت وزیرمتن (self-hosted، نسخه متغیر) ─── */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Variable.woff2') format('woff2-variations'),
       url('../fonts/Vazirmatn-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ─── توکن‌های طراحی ─── */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --accent: #0066ff;
  --accent-soft: rgba(0, 102, 255, 0.08);
  --danger: #ff3b30;
  --success: #34c759;
  --black: #0f0f10;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.14);
  --header-h: 64px;
}

/* ─── ریست ─── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: rgba(0, 102, 255, 0.18); }

/* اسکرول‌بار ظریف */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 24px; }

/* ─── پس‌زمینه تزئینی نرم ─── */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-a { width: 480px; height: 480px; top: -180px; left: -120px;
  background: radial-gradient(circle, rgba(0,102,255,0.14), transparent 70%); }
.orb-b { width: 420px; height: 420px; top: -120px; right: -100px;
  background: radial-gradient(circle, rgba(124,58,237,0.10), transparent 70%); }

/* ─── هدر ─── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(250, 250, 250, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #0f0f10, #3a3a3c);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.header-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { color: var(--text-2); font-size: 0.92rem; font-weight: 500; padding: 6px 12px; border-radius: 999px; transition: color .2s, background .2s; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; color: var(--text-2); border: 1px solid var(--border);
  background: var(--surface); transition: color .2s, border-color .2s, transform .2s;
}
.nav-icon:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }

.site-main { flex: 1; }

/* ─── هیرو ─── */
.hero { padding: 72px 0 40px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.8rem; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(52,199,89,.15); }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 800; line-height: 1.35; letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.hero-sub { color: var(--text-2); font-size: 1.05rem; max-width: 560px; margin: 0 auto 34px; }

/* جستجو */
.search-wrap { position: relative; max-width: 520px; margin: 0 auto 30px; }
.search-wrap .search-icon {
  position: absolute; top: 50%; right: 18px; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; transition: color .2s;
}
.search-wrap:focus-within .search-icon { color: var(--accent); }
.search-input {
  width: 100%; height: 56px; padding: 0 52px 0 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: 1rem; box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md); }
.search-clear {
  position: absolute; top: 50%; left: 14px; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2); display: none; place-items: center;
  cursor: pointer;
}
.search-clear:hover { background: #ebebef; }
.search-wrap.has-value .search-clear { display: grid; }

/* آمار */
.hero-stats { display: flex; justify-content: center; gap: clamp(20px, 6vw, 56px); flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--text-2); font-weight: 500; }

/* ─── چیپ‌های دسته‌بندی ─── */
.chips-row { position: sticky; top: var(--header-h); z-index: 40; padding: 14px 0 10px;
  background: linear-gradient(var(--bg) 82%, transparent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.86rem; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .18s; user-select: none;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }
.chip .count { opacity: .6; font-weight: 500; margin-inline-start: 4px; }

/* ─── گرید کارت‌ها ─── */
.files-section { padding-bottom: 64px; }
.files-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.file-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, border-color .22s;
  position: relative; overflow: hidden;
}
.file-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px at var(--mx, 50%) var(--my, -20%), rgba(0,102,255,0.05), transparent 60%);
  opacity: 0; transition: opacity .3s;
}
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.file-card:hover::after { opacity: 1; }
.file-card.hide { display: none; }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.ftype {
  --fg: #64748b; --bg: #f1f5f9;
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px;
  display: grid; place-items: center; color: var(--fg); background: var(--bg);
}
.card-title-wrap { min-width: 0; flex: 1; }
.card-title {
  font-size: 0.98rem; font-weight: 700; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.card-cat { font-size: 0.74rem; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.card-desc {
  font-size: 0.86rem; color: var(--text-2); line-height: 1.8;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(0.86rem * 1.8 * 2);
}
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-3); flex-wrap: wrap; }
.card-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .6; }
.card-meta .dl-count { display: inline-flex; align-items: center; gap: 4px; }
.card-meta svg { flex-shrink: 0; }

.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .grow { flex: 1; }

/* ─── دکمه‌ها ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: 12px;
  font-size: 0.9rem; font-weight: 700; border: 1px solid transparent;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--black); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #262629; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e0342b; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 0.84rem; border-radius: 10px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  display: inline-grid; place-items: center;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.btn-icon.btn-icon-sm { width: 34px; height: 34px; border-radius: 10px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }

/* ─── فرم‌ها ─── */
.input, .textarea, .select {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; font-size: 0.92rem;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 74px; line-height: 1.8; }
.form-label { display: block; font-size: 0.84rem; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.form-hint { font-size: 0.78rem; color: var(--text-3); margin-top: 6px; }

/* ─── حالت خالی ─── */
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-2); }
.empty-state .empty-icon {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  display: grid; place-items: center; color: var(--text-3);
}
.empty-state h3 { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.9rem; }
.hidden { display: none !important; }

/* ─── فوتر ─── */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 18px; gap: 12px; flex-wrap: wrap; }
.footer-copy { font-size: 0.82rem; color: var(--text-3); }
.footer-admin { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; color: var(--text-3); transition: color .2s; }
.footer-admin:hover { color: var(--text); }

/* ─── توست ─── */
#toast-root { position: fixed; bottom: 24px; right: 50%; transform: translateX(50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--black); color: #fff; font-size: 0.88rem; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; box-shadow: var(--shadow-lg);
  animation: toast-in .3s cubic-bezier(.2,.8,.3,1.2);
  max-width: min(92vw, 420px);
}
.toast.out { animation: toast-out .25s forwards; }
.toast .t-ok { color: var(--success); } .toast .t-err { color: #ff6961; } .toast .t-info { color: #7ab8ff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.95); } }

/* ─── مودال ─── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(20, 20, 22, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .2s;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 26px;
  width: 100%; max-width: 380px; position: relative;
  animation: pop-in .25s cubic-bezier(.2,.8,.3,1.15);
}
.modal-title { font-size: 1.05rem; font-weight: 800; margin-bottom: 14px; text-align: center; }
.modal-close {
  position: absolute; top: 14px; left: 14px;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer;
  transition: background .2s, color .2s;
}
.modal-close:hover { background: #ebebef; color: var(--text); }
.qr-box { width: 220px; height: 220px; margin: 0 auto; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; background: #fff; display: grid; place-items: center; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-hint { text-align: center; font-size: 0.8rem; color: var(--text-2); margin: 12px 0 14px; }
.qr-link-row { display: flex; gap: 8px; }
.qr-link { font-size: 0.78rem; color: var(--text-2); direction: ltr; text-align: left; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── انیمیشن نمایش هنگام اسکرول ─── */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ─── ریسپانسیو ─── */
@media (max-width: 640px) {
  .hero { padding: 48px 0 30px; }
  .hero-sub { font-size: 0.95rem; }
  .search-input { height: 52px; }
  .files-grid { grid-template-columns: 1fr; gap: 14px; }
  .footer-inner { justify-content: center; text-align: center; }
  .stat-num { font-size: 1.45rem; }
}
