/* ═══════════════════════════════════════════════
   مرکز دانلود — استایل پنل مدیریت
   ═══════════════════════════════════════════════ */

/* ─── چیدمان کلی ─── */
.admin-body { flex-direction: row; }

.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: 250px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.2,.7,.3,1);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.sidebar-head .brand { font-size: 0.98rem; }
.sidebar-close { display: none; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-2); cursor: pointer; place-items: center; }

.sidebar-nav { flex: 1; padding: 10px 14px; overflow-y: auto; }
.nav-section {
  display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-3);
  padding: 14px 10px 6px; letter-spacing: .02em;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  font-size: 0.92rem; font-weight: 600; color: var(--text-2);
  transition: background .18s, color .18s;
  margin-bottom: 3px;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--black); color: #fff; box-shadow: var(--shadow-sm); }
.side-danger { color: var(--danger); }
.side-danger:hover { background: rgba(255,59,48,.08); color: var(--danger); }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--border); }
.sidebar-foot .ver { font-size: 0.74rem; color: var(--text-3); }

.sidebar-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(20,20,22,.4); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}

.admin-content { flex: 1; margin-right: 250px; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.admin-topbar {
  position: sticky; top: 0; z-index: 60;
  height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(250,250,250,.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.hamburger { display: none; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-2); cursor: pointer; place-items: center; }
.topbar-title { font-size: 1.05rem; font-weight: 800; flex: 1; }
.topbar-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 600; color: var(--text-2); padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); transition: color .2s, border-color .2s; }
.topbar-link:hover { color: var(--text); border-color: var(--border-strong); }

.admin-main { flex: 1; padding: 26px 28px 50px; max-width: 1080px; width: 100%; margin-inline: auto; }

/* ─── کارت‌های آمار ─── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { --fg:#64748b; --bg:#f1f5f9; width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px; display: grid; place-items: center; color: var(--fg); background: var(--bg); }
.sc-num { display: block; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.4; }
.sc-label { display: block; font-size: 0.76rem; color: var(--text-2); font-weight: 500; }

/* ─── پنل‌ها ─── */
.panel-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-title { font-size: 0.98rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.panel-title svg { color: var(--text-2); }
.panel-hint { font-size: 0.78rem; color: var(--text-3); font-weight: 500; }
.panel-link { font-size: 0.84rem; font-weight: 700; color: var(--accent); }
.panel-link:hover { text-decoration: underline; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ─── نمودار ─── */
.chart-wrap { overflow-x: auto; }
.dl-chart { width: 100%; min-width: 640px; height: auto; }

/* ─── لیست آخری‌ها ─── */
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-info { flex: 1; min-width: 0; }
.recent-title { font-weight: 700; font-size: 0.92rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-title:hover { color: var(--accent); }
.recent-meta { font-size: 0.78rem; color: var(--text-3); }

/* ─── کارت‌های دسترسی سریع ─── */
.quick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  font-weight: 700; font-size: 0.9rem; color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, color .2s;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.quick-card svg { color: var(--accent); }

/* ─── جستجوی کوچک ─── */
.mini-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; min-width: 200px;
  color: var(--text-3);
}
.mini-search input { border: none; background: transparent; outline: none; font-size: 0.86rem; width: 100%; color: var(--text); }
.mini-search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─── جدول فایل‌ها ─── */
.table-wrap { overflow-x: auto; }
.files-table { width: 100%; border-collapse: collapse; }
.files-table th {
  text-align: right; font-size: 0.76rem; font-weight: 700; color: var(--text-3);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
.files-table th.sortable { cursor: pointer; }
.files-table th.sortable:hover { color: var(--text); }
.sort-arrow { display: inline-block; width: 8px; height: 8px; margin-inline-start: 2px; }
.files-table th.asc .sort-arrow::after { content: '↑'; }
.files-table th.desc .sort-arrow::after { content: '↓'; }
.files-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
.files-table tbody tr { transition: background .15s; }
.files-table tbody tr:hover { background: var(--surface-2); }
.files-table tbody tr:last-child td { border-bottom: none; }

.cell-title { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.cell-title-txt { min-width: 0; }
.cell-title-txt strong { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.orig-name { display: block; font-size: 0.72rem; color: var(--text-3); direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.cat-pill { background: var(--surface-2); border: 1px solid var(--border); padding: 3px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.cell-size, .cell-dl, .cell-date { color: var(--text-2); white-space: nowrap; }
.cell-actions { display: flex; gap: 5px; }

/* ─── فرم‌ها و ردیف‌های آپلود ─── */
.form-group { margin-bottom: 15px; }
.settings-form { max-width: 520px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
  background: transparent;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-icon { color: var(--text-3); display: inline-block; margin-bottom: 10px; transition: color .2s; }
.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { color: var(--accent); }
.dz-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
.dz-hint { font-size: 0.82rem; color: var(--text-2); }

#file-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.file-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; background: var(--surface-2);
}
.row-main { display: flex; gap: 12px; align-items: flex-start; }
.row-icon { width: 42px; height: 42px; border-radius: 12px; }
.row-fields { flex: 1; min-width: 0; }
.row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.row-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.76rem; color: var(--text-2); margin-top: 10px; }
.f-status.done { color: var(--success); font-weight: 700; }
.f-status.err { color: var(--danger); font-weight: 700; }
.row-remove { flex-shrink: 0; }
.row-done { border-color: rgba(52,199,89,.5); background: rgba(52,199,89,.05); }
.row-error { border-color: rgba(255,59,48,.5); background: rgba(255,59,48,.05); }

.progress { height: 7px; background: #e8e8ed; border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #0066ff, #4f8dff);
  border-radius: 999px;
  transition: width .25s ease;
}

.upload-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 0.95rem; border-radius: 13px; }

/* ─── حالت خالی کوچک ─── */
.empty-mini { text-align: center; padding: 34px 16px; color: var(--text-2); }
.empty-mini-icon {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  display: grid; place-items: center; color: var(--text-3);
}
.empty-mini p { font-size: 0.9rem; }
.empty-mini a { color: var(--accent); font-weight: 700; }
.empty-mini a:hover { text-decoration: underline; }

/* ─── هشدارها ─── */
.alert {
  display: flex; align-items: center; gap: 9px;
  border-radius: 12px; padding: 11px 16px; font-size: 0.88rem; font-weight: 600;
  margin-bottom: 15px;
}
.alert-ok { background: rgba(52,199,89,.1); color: #1e7e3e; border: 1px solid rgba(52,199,89,.3); }
.alert-err { background: rgba(255,59,48,.08); color: #c22720; border: 1px solid rgba(255,59,48,.3); }

/* ─── مودال‌ها ─── */
.del-icon {
  width: 62px; height: 62px; margin: 4px auto 12px; border-radius: 18px;
  background: rgba(255,59,48,.1); color: var(--danger);
  display: grid; place-items: center;
}
.del-text { text-align: center; font-size: 0.9rem; color: var(--text-2); margin-bottom: 18px; line-height: 2; }
.del-actions { display: flex; gap: 10px; }
.del-actions .btn { flex: 1; }
.edit-file-name { font-size: 0.78rem; color: var(--text-3); direction: ltr; text-align: left; margin-bottom: 14px; background: var(--surface-2); padding: 8px 12px; border-radius: 9px; }

/* ─── صفحه لاگین ─── */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 17px;
  background: linear-gradient(135deg, #0f0f10, #3a3a3c);
  display: grid; place-items: center; box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; }
.login-sub { font-size: 0.86rem; color: var(--text-2); margin-bottom: 22px; }
.login-error {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,59,48,.08); border: 1px solid rgba(255,59,48,.3);
  color: #c22720; font-size: 0.84rem; font-weight: 600;
  padding: 10px 14px; border-radius: 11px; margin-bottom: 16px;
  text-align: right;
}
.pass-wrap { position: relative; }
.pass-wrap .input { padding-left: 46px; direction: ltr; text-align: left; }
.pass-toggle {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent;
  color: var(--text-3); cursor: pointer; border-radius: 8px;
  display: grid; place-items: center; transition: color .2s;
}
.pass-toggle:hover { color: var(--text); }
.login-card .btn { margin-top: 6px; }
.login-back { display: inline-block; margin-top: 18px; font-size: 0.82rem; color: var(--text-3); transition: color .2s; }
.login-back:hover { color: var(--text); }

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.shake { animation: shake .5s both; }

/* ─── لیست نکات ─── */
.tips-list { display: flex; flex-direction: column; gap: 10px; font-size: 0.88rem; color: var(--text-2); }
.tips-list li { position: relative; padding-inline-start: 20px; line-height: 1.9; }
.tips-list li::before {
  content: ''; position: absolute; right: 2px; top: 11px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.info-card .panel-title { margin-bottom: 14px; }

/* ─── ریسپانسیو پنل ─── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  .admin-body.sidebar-open .sidebar { transform: translateX(0); }
  .admin-body.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-close { display: grid; }
  .admin-content { margin-right: 0; }
  .hamburger { display: grid; }
  .admin-main { padding: 18px 16px 40px; }
  .admin-topbar { padding: 0 16px; }

  /* جدول → لیست کارتی */
  .files-table, .files-table tbody, .files-table tr, .files-table td { display: block; }
  .files-table thead { display: none; }
  .files-table tr.frow {
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 12px; padding: 12px; background: var(--surface);
  }
  .files-table td { border: none; padding: 6px 2px; }
  .cell-title { min-width: 0; }
  .cell-title-txt strong { max-width: 100%; white-space: normal; }
  .orig-name { max-width: 100%; }
  .cell-actions { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .row-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; align-items: flex-start; }
}
