/* ================= فونت وزیرمتن (لوکال) ================= */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #16202c;
  --muted: #6b7a8d;
  --border: #e4e9f0;
  --brand: #0f766e;
  --brand-soft: #e6f4f1;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 35, 60, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

body, input, button, select, textarea, table { font-family: 'Vazirmatn', system-ui, sans-serif; }

a { color: var(--brand); text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 120px; }

/* ================= هدر ================= */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.brand h1 { font-size: 1rem; margin: 0; font-weight: 700; }
.clock { font-size: .82rem; color: var(--muted); }

/* ================= کارت‌ها ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 1rem; margin: 0; }

/* ================= فرم ================= */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.input, select.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: transform .15s, filter .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: .8rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ================= دکمه شناور ================= */
.fab {
  position: fixed;
  inset-inline-start: 22px;
  bottom: 22px;
  z-index: 30;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 15px 22px;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(15, 118, 110, .35);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  animation: pulse 2.8s ease-in-out infinite;
  transition: transform .18s;
}
.fab:hover { transform: translateY(-3px); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 14px 34px rgba(15, 118, 110, .32); }
  50% { box-shadow: 0 14px 44px rgba(15, 118, 110, .5); }
}
.fab .plus { font-size: 1.25rem; line-height: 1; }

/* ================= پنجره شناور ================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 22, 34, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 20px;
  padding: 20px;
  transform: translateY(22px) scale(.97);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.modal.open .modal-box { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 1rem; }
.icon-btn { background: none; border: none; font-size: 1.3rem; color: var(--muted); cursor: pointer; line-height: 1; }

/* ================= جدول ================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: #f9fbfd; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; }
.badge-live { background: #e7f8ef; color: #1c7a4d; }
.badge-soon { background: #fff6e5; color: var(--warn); }
.badge-done { background: #f1f3f6; color: var(--muted); }
.badge-arch { background: #eef0ff; color: #4451b1; }

.link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f7f9fc;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: .8rem;
}
.link-box input { border: none; background: transparent; flex: 1; direction: ltr; font-size: .78rem; }
.link-box input:focus { outline: none; }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: .9rem; }

/* ================= لودینگ ================= */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-dark { border-color: var(--border); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 247, 250, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 90;
  color: var(--muted);
  font-size: .9rem;
}
.skeleton { height: 44px; border-radius: 12px; background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; margin-bottom: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ================= اعلان ================= */
.toast-wrap { position: fixed; top: 16px; inset-inline-start: 50%; transform: translateX(50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #16202c;
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: .88rem;
  box-shadow: var(--shadow);
  animation: toastIn .35s cubic-bezier(.2, .8, .2, 1);
}
.toast.ok { background: #12795c; }
.toast.err { background: #a5342a; }
.toast.hide { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px); } }

/* ================= ورود ================= */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 18px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { font-size: 1.05rem; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: .85rem; margin: 0 0 18px; }
.lock {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.error-text { color: var(--danger); font-size: .84rem; margin-top: 10px; min-height: 20px; }

/* ================= تقویم شمسی ================= */
.picker-field { position: relative; }
.dp {
  position: relative;
  z-index: 70;
  margin-top: 8px;
  width: 100%;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  animation: rise .22s ease both;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-size: .9rem; font-weight: 500; }
.dp-nav { background: var(--brand-soft); color: var(--brand); border: none; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 1rem; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-dow { font-size: .7rem; color: var(--muted); text-align: center; padding: 4px 0; }
.dp-day { border: none; background: none; padding: 7px 0; border-radius: 9px; cursor: pointer; font-size: .82rem; transition: background .15s, color .15s; }
.dp-day:hover { background: var(--brand-soft); }
.dp-day.today { color: var(--brand); font-weight: 700; }
.dp-day.selected { background: var(--brand); color: #fff; }
.dp-day.blank { visibility: hidden; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; }

.tp { max-width: 220px; }
.tp-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tp-col { text-align: center; }
.tp-col button { display: block; width: 44px; background: var(--brand-soft); color: var(--brand); border: none; border-radius: 9px; padding: 4px 0; cursor: pointer; margin: 3px 0; }
.tp-col span { font-size: 1.1rem; font-weight: 700; display: block; padding: 4px 0; }
.tp-label { font-size: .72rem; color: var(--muted); }

/* ================= صفحه حضور ================= */
.attend-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 18px; }
.attend-card { width: 100%; max-width: 440px; }
.course-meta { background: #f7f9fc; border-radius: 14px; padding: 12px 14px; font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.course-meta strong { color: var(--text); }
.course-meta .row { display: flex; justify-content: space-between; gap: 8px; }
.state-icon { width: 62px; height: 62px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; margin: 0 auto 14px; }
.state-ok { background: #e7f8ef; color: #1c7a4d; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.state-warn { background: #fff6e5; color: var(--warn); }
.state-err { background: #fdecea; color: var(--danger); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.center { text-align: center; }
.mt { margin-top: 14px; }
.muted { color: var(--muted); font-size: .85rem; }

@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
  .brand h1 { font-size: .86rem; }
  .fab { padding: 13px 18px; font-size: .88rem; inset-inline-start: 14px; bottom: 14px; }
  .container { padding-bottom: 110px; }
}


/* ================= نوار ابزار رکوردها ================= */

.records-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 14px;
}

.records-toolbar .btn {
  white-space: nowrap;
}

@media (max-width: 620px) {
  .records-toolbar {
    width: 100%;
  }

  .records-toolbar .btn {
    width: 100%;
  }
}