/* ─── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --color-primary: #4f46e5;
  --color-surface: #f8f9fc;
  --color-border: #e5e7eb;
  --font: 'Vazirmatn', Tahoma, sans-serif;
}
body { font-family: var(--font); background: var(--color-surface); color: #1e293b; margin: 0; }
a { text-decoration: none; color: inherit; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.fw-500 { font-weight: 500; }
.letter-spacing { letter-spacing: 6px; font-size: 1.4rem; }

/* ─── Auth ──────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea22, #764ba222), var(--color-surface); }
.auth-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.auth-card { background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.nav-pills .nav-link { font-size: 0.85rem; color: #64748b; }
.nav-pills .nav-link.active { background: var(--color-primary); }

/* ─── Layout ────────────────────────────────────────────────── */
.wrapper { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: #fff; border-left: 1px solid var(--color-border);
  display: flex; flex-direction: column; position: fixed; top: 0; right: 0;
  height: 100vh; z-index: 100; transition: transform .25s;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: #1e293b; }
.btn-toggle { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: #64748b; }
.btn-toggle:hover { background: var(--color-surface); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; flex-shrink: 0; }
.nav-menu { list-style: none; padding: 0.5rem 0; margin: 0; flex: 1; overflow-y: auto; }
.nav-item a { display: flex; align-items: center; gap: 10px; padding: 10px 1.25rem; color: #475569; font-size: 0.875rem; transition: all .15s; border-right: 3px solid transparent; }
.nav-item a:hover { background: var(--color-surface); color: var(--color-primary); }
.nav-item.active a { background: #ede9fe; color: var(--color-primary); font-weight: 500; border-right-color: var(--color-primary); }
.nav-item a i { font-size: 1.1rem; flex-shrink: 0; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); }
.logout-btn { display: flex; align-items: center; gap: 8px; color: #ef4444; font-size: 0.875rem; cursor: pointer; }
.logout-btn:hover { color: #dc2626; }

/* ─── Main ──────────────────────────────────────────────────── */
.main-content { margin-right: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; color: #64748b; display: none; }
.btn-icon:hover { background: var(--color-surface); }
.page-title { font-size: 1rem; font-weight: 600; margin: 0; }
.breadcrumb-area { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ─── Content ───────────────────────────────────────────────── */
.content-area { padding: 1.5rem; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden; }
.card-header { padding: .875rem 1.25rem; border-bottom: 1px solid var(--color-border); background: #fff; display: flex; align-items: center; }
.card-body { padding: 1.25rem; }

/* ─── Stat cards ────────────────────────────────────────────── */
.stat-card { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; padding: 1.25rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; margin-bottom: .75rem; }
.bg-primary-soft { background: #ede9fe; }
.bg-success-soft { background: #dcfce7; }
.bg-warning-soft { background: #fef9c3; }
.bg-info-soft { background: #dbeafe; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-top: 4px; }

/* ─── Table ─────────────────────────────────────────────────── */
.table { margin: 0; }
.table th { font-size: 0.8rem; color: #64748b; font-weight: 500; white-space: nowrap; border-bottom: 1px solid var(--color-border); padding: 10px 16px; }
.table td { font-size: 0.875rem; vertical-align: middle; padding: 10px 16px; }
.table-hover tbody tr:hover { background: #f8f9fc; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-label { font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: #ef4444; }
.form-control, .form-select { font-size: 0.875rem; border-color: var(--color-border); border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px #4f46e51a; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn { font-size: 0.875rem; border-radius: 8px; padding: 7px 16px; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }

/* ─── TipTap Editor ─────────────────────────────────────────── */
.tiptap-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 6px 10px; background: #f8f9fc; border: 1px solid var(--color-border);
  border-bottom: none; border-radius: 8px 8px 0 0;
}
.tiptap-toolbar button { background: none; border: none; cursor: pointer; padding: 5px 8px; border-radius: 6px; color: #475569; font-size: 1rem; transition: all .1s; }
.tiptap-toolbar button:hover { background: #e2e8f0; color: var(--color-primary); }
.tiptap-toolbar .divider { width: 1px; height: 20px; background: var(--color-border); margin: 0 4px; }
.tiptap-content {
  border: 1px solid var(--color-border); border-radius: 0 0 8px 8px;
  min-height: 280px; padding: 1rem; outline: none;
}
.tiptap-inner { min-height: 260px; outline: none; line-height: 1.8; }
.tiptap-inner h2 { font-size: 1.3rem; margin: 1rem 0 .5rem; }
.tiptap-inner h3 { font-size: 1.1rem; margin: .75rem 0 .25rem; }
.tiptap-inner blockquote { border-right: 3px solid var(--color-primary); padding-right: 1rem; color: #64748b; margin: .75rem 0; }
.tiptap-inner ul, .tiptap-inner ol { padding-right: 1.5rem; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .btn-icon { display: inline-flex; }
}
