/* ===== Tokens ===== */
@font-face {
  font-family: "Vazirmatn";
  src: local("Vazirmatn"), url("/assets/fonts/Vazirmatn.woff2") format("woff2");
  font-display: swap;
}
:root {
  --ink: #0d2236;
  --ink-2: #16314a;
  --blue: #0074bb;
  --blue-dark: #005a93;
  --bg: #f2f5f8;
  --card: #ffffff;
  --line: #dbe3ea;
  --text: #14202b;
  --muted: #5b6b7a;
  --danger: #b4332a;
  --danger-bg: #fdecea;
  --ok: #1f7a4a;
  --ok-bg: #e7f6ee;
  --info-bg: #e8f2fa;
  --radius: 10px;
  --sidebar-w: 264px;
  --font: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
.icon { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.ltr { direction: ltr; text-align: right; unicode-bidi: plaintext; }
:focus-visible { outline: 3px solid rgba(0, 116, 187, .45); outline-offset: 2px; }

/* ===== Buttons & forms ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none;
  background: var(--blue); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .65; cursor: wait; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.input-wrap { position: relative; }
.form-control {
  width: 100%; padding: 10px 14px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 116, 187, .18); }
.input-wrap .form-control { padding-left: 44px; padding-right: 44px; }
.input-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.input-action {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  display: flex; padding: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px;
}
.input-action:hover { color: var(--text); background: var(--bg); }
.hint { margin-top: 6px; font-size: 13px; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f4c7c3; }
.alert-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe3cf; }
.alert-info { background: var(--info-bg); color: var(--blue-dark); border: 1px solid #c4dff1; }
.alert ul { margin: 0; padding-right: 18px; }

/* ===== Auth layout ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; }
.auth-logo { width: 150px; margin: 0 auto 20px; }
.auth-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.error-code { font-size: 56px; font-weight: 800; color: var(--blue); text-align: center; line-height: 1.2; }
.error-detail { margin-top: 16px; padding: 12px; background: var(--bg); border-radius: 8px; font-size: 12px; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.15fr 1fr; }
  .auth-main { background: var(--bg); }
  .auth-logo { display: none; }   /* the big animated logo replaces it on desktop */
}

/* ===== Animated logo (login side panel) ===== */
.auth-side { display: none; }
@media (min-width: 900px) {
  .auth-side {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 48px; position: relative; overflow: hidden; color: #fff;
    background: radial-gradient(circle at 50% 40%, #14406a 0%, var(--ink) 64%);
  }
}
.lm-stage { position: relative; width: 100%; max-width: 480px; padding: 56px 0; }
.lm-glow {
  position: absolute; left: 50%; top: 50%; width: 130%; height: 230%;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 150, 219, .38), transparent);
  animation: lmGlow 5s ease-in-out infinite alternate;
}
.lm-plate-wrap { position: relative; width: 100%; }
.lm-ring {
  position: absolute; left: 50%; top: 50%; width: 100%; height: 100%;
  border: 1px solid rgba(77, 179, 238, .55); border-radius: 28px; pointer-events: none;
  opacity: 0; transform: translate(-50%, -50%) scale(.7);
  animation: lmRing 5.4s ease-out infinite;
}
.lm-ring-1 { animation-delay: 1.8s; }
.lm-ring-2 { animation-delay: 3.6s; }
.lm-ring-3 { animation-delay: 5.4s; }
.lm-plate {
  position: relative; overflow: hidden; background: #fff; border-radius: 22px;
  padding: 34px 38px 30px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, .38), 0 0 0 1px rgba(255, 255, 255, .7);
  animation: lmPlateIn .8s cubic-bezier(.2, .8, .2, 1) both;
}
.lm-plate::after {   /* light sweep across the logo, repeats */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 42%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .9), transparent);
  transform: translateX(-180%) skewX(-20deg);
  animation: lmShine 8s ease-in-out 3s infinite;
}
.logo-motion { display: block; width: 100%; height: auto; overflow: visible; }
.lm-tri, .lm-letter, .lm-s { transform-box: fill-box; transform-origin: 50% 100%; }
.lm-tri { animation: lmTriDrop .9s cubic-bezier(.3, 1.4, .5, 1) both; }
.lm-t1 { animation-delay: .55s; }
.lm-t2 { animation-delay: .72s; }
.lm-t3 { animation-delay: .95s; transform-origin: 50% 0; }
.lm-letter { animation: lmRise .7s cubic-bezier(.2, .8, .2, 1) both; }
.lm-l1 { animation-delay: 1.10s; } .lm-l2 { animation-delay: 1.18s; }
.lm-l3 { animation-delay: 1.26s; } .lm-l4 { animation-delay: 1.34s; }
.lm-l5 { animation-delay: 1.42s; } .lm-l6 { animation-delay: 1.50s; }
.lm-l7 { animation-delay: 1.58s; } .lm-l8 { animation-delay: 1.66s; }
.lm-s { animation: lmFade .5s ease both; }
.lm-s1 { animation-delay: 2.00s; } .lm-s2 { animation-delay: 2.06s; } .lm-s3 { animation-delay: 2.12s; }
.lm-s4 { animation-delay: 2.18s; } .lm-s5 { animation-delay: 2.24s; } .lm-s6 { animation-delay: 2.30s; }
.lm-s7 { animation-delay: 2.36s; } .lm-s8 { animation-delay: 2.42s; } .lm-s9 { animation-delay: 2.48s; }

.lm-divider {
  display: block; width: 76px; height: 3px; border-radius: 3px; margin: 8px auto 22px;
  background: linear-gradient(90deg, #0096db, #4db3ee);
  animation: lmLine .7s ease 2.3s both;
}
.auth-side h2 { font-size: 30px; line-height: 1.5; font-weight: 800; animation: lmUp .7s ease 2.5s both; }
.auth-side p { margin-top: 10px; color: #a9bccd; animation: lmUp .7s ease 2.7s both; }

@keyframes lmPlateIn { from { opacity: 0; transform: translateY(20px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes lmTriDrop {
  0%   { opacity: 0; transform: translateY(-80px) scale(.5) rotate(-14deg); }
  62%  { opacity: 1; transform: translateY(6px) scale(1.07) rotate(2deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes lmRise { from { opacity: 0; transform: translateY(28px) scaleY(.7); } to { opacity: 1; transform: none; } }
@keyframes lmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lmUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes lmLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lmGlow { from { opacity: .55; } to { opacity: 1; } }
@keyframes lmRing {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.75); }
  15%  { opacity: .55; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}
@keyframes lmShine {
  0%        { transform: translateX(-180%) skewX(-20deg); }
  24%, 100% { transform: translateX(340%) skewX(-20deg); }
}
@media (prefers-reduced-motion: reduce) {
  .lm-glow, .lm-ring, .lm-plate, .lm-plate::after, .lm-tri, .lm-letter, .lm-s,
  .lm-divider, .auth-side h2, .auth-side p { animation: none !important; }
  .lm-ring { display: none; }
}

/* ===== App layout ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--ink); color: #dce7f1;
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-brand { background: #fff; border-radius: 10px; padding: 10px 16px; margin-bottom: 18px; }
.sidebar-brand img { height: 42px; margin: 0 auto; }
.sidebar-user { padding: 12px 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); margin-bottom: 12px; }
.sidebar-user strong { display: block; color: #fff; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; background: rgba(0, 116, 187, .25); color: #9fd3f3; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: #c3d3e2; text-decoration: none; border-right: 3px solid transparent;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active { background: rgba(0, 116, 187, .28); color: #fff; border-right-color: #4db3ee; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar-foot .btn { color: #dce7f1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; flex: 1; }
.topbar .date { color: var(--muted); font-size: 13px; }
.menu-toggle { display: none; border: 0; background: none; padding: 6px; cursor: pointer; color: var(--text); }
.content { padding: 28px; max-width: 1100px; width: 100%; }
.overlay { display: none; }

/* ===== Cards, stats, tables ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card h2, .card h3 { font-size: 16px; margin-bottom: 14px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.welcome h2 { font-size: 20px; margin-bottom: 4px; }
.welcome .badge { background: var(--info-bg); color: var(--blue-dark); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-icon { width: 46px; height: 46px; border-radius: 10px; background: var(--info-bg); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 8px 0; }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ===== Mobile ===== */
@media (max-width: 899px) {
  .sidebar { position: fixed; inset-block: 0; right: 0; transform: translateX(100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; }
  .overlay { position: fixed; inset: 0; background: rgba(13, 34, 54, .55); z-index: 20; }
  .overlay.is-open { display: block; }
  .menu-toggle { display: flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .topbar .date { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
