/* GYMOO design system — shared by the public site, athlete panel, admin and support panels.
   Dark navy + electric violet + energetic lime. RTL first. Light and dark themes are both first-class. */

@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font: "Vazirmatn", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  --bg: #070B16;
  --bg-glow: rgba(124, 92, 255, .16);
  --surface: #0F1526;
  --surface-2: #161E35;
  --surface-3: #1E2846;
  --border: #232C47;
  --border-strong: #2F3A5E;
  --text: #EEF1FA;
  --text-2: #A3ADC8;
  --text-3: #6B7594;

  --violet: #7C5CFF;
  --violet-2: #9B83FF;
  --violet-soft: rgba(124, 92, 255, .16);
  --lime: #C6FF3D;
  --lime-ink: #0A0E1A;
  --lime-text: #C6FF3D;
  --lime-soft: rgba(198, 255, 61, .12);
  --success: #2FD47A;
  --success-soft: rgba(47, 212, 122, .14);
  --danger: #FF4D6D;
  --danger-soft: rgba(255, 77, 109, .14);
  --warning: #FFB547;
  --warning-soft: rgba(255, 181, 71, .14);
  --info: #4CC2FF;
  --info-soft: rgba(76, 194, 255, .14);

  --grad: linear-gradient(135deg, #7C5CFF 0%, #5B8CFF 55%, #C6FF3D 130%);
  --grad-soft: linear-gradient(135deg, rgba(124, 92, 255, .22), rgba(198, 255, 61, .06));

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
  --ring: 0 0 0 3px rgba(124, 92, 255, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 68px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F5FB; --bg-glow: rgba(106, 71, 255, .10);
    --surface: #FFFFFF; --surface-2: #F1F3FA; --surface-3: #E7EAF5;
    --border: #E2E6F0; --border-strong: #CDD3E4;
    --text: #0E1324; --text-2: #4A5372; --text-3: #8A92AC;
    --violet: #6A47FF; --violet-2: #5536E6; --violet-soft: rgba(106, 71, 255, .10);
    --lime: #C6FF3D; --lime-text: #4C7A00; --lime-soft: rgba(126, 190, 0, .12);
    --success: #12A85A; --danger: #E5354F; --warning: #C77A00; --info: #0A8FD6;
    --shadow: 0 10px 30px rgba(20, 28, 60, .10); --shadow-sm: 0 2px 10px rgba(20, 28, 60, .07);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F4F5FB; --bg-glow: rgba(106, 71, 255, .10);
  --surface: #FFFFFF; --surface-2: #F1F3FA; --surface-3: #E7EAF5;
  --border: #E2E6F0; --border-strong: #CDD3E4;
  --text: #0E1324; --text-2: #4A5372; --text-3: #8A92AC;
  --violet: #6A47FF; --violet-2: #5536E6; --violet-soft: rgba(106, 71, 255, .10);
  --lime: #C6FF3D; --lime-text: #4C7A00; --lime-soft: rgba(126, 190, 0, .12);
  --success: #12A85A; --danger: #E5354F; --warning: #C77A00; --info: #0A8FD6;
  --shadow: 0 10px 30px rgba(20, 28, 60, .10); --shadow-sm: 0 2px 10px rgba(20, 28, 60, .07);
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.75;
  font-feature-settings: "ss01"; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--violet-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.35; font-weight: 800; letter-spacing: -.2px; }
h1 { font-size: clamp(28px, 5vw, 46px); font-weight: 900; }
h2 { font-size: clamp(22px, 3.4vw, 32px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--violet); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 800; }
.lime { color: var(--lime-text); }
.violet { color: var(--violet-2); }
.ok { color: var(--success); }
.bad { color: var(--danger); }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- layout helpers */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  --b-bg: var(--surface-2); --b-fg: var(--text); --b-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font-weight: 700; font-size: 14.5px;
  cursor: pointer; text-decoration: none !important; white-space: nowrap; user-select: none;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { --b-bg: var(--lime); --b-fg: var(--lime-ink); --b-bd: transparent; box-shadow: 0 6px 20px rgba(198, 255, 61, .18); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.violet { --b-bg: var(--violet); --b-fg: #fff; --b-bd: transparent; box-shadow: 0 6px 20px rgba(124, 92, 255, .28); }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--text-2); }
.btn.ghost:hover { --b-bg: var(--surface-2); --b-fg: var(--text); }
.btn.outline { --b-bg: transparent; }
.btn.danger { --b-bg: var(--danger-soft); --b-fg: var(--danger); --b-bd: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 54px; padding: 0 26px; font-size: 16px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-inline-start-color: transparent; border-radius: 50%; animation: g-spin .8s linear infinite; }

/* ---------------------------------------------------------------- cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; }
.card.pad-lg { padding: 24px; }
.card.flat { box-shadow: none; }
.card.glow { background: var(--grad-soft), var(--surface); border-color: rgba(124, 92, 255, .35); }
.card.hover { transition: transform .2s var(--ease), border-color .2s; cursor: pointer; }
.card.hover:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h3 { margin: 0; font-size: 16px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.panel { background: var(--surface-2); border-radius: var(--r); padding: 14px; }

/* ---------------------------------------------------------------- chips, badges, tags */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s; user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on, .chip[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: var(--text); }
.chip svg { width: 16px; height: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.lime { background: var(--lime-soft); color: var(--lime-text); }
.badge.violet { background: var(--violet-soft); color: var(--violet-2); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.8; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--violet); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input.big { min-height: 58px; font-size: 20px; font-weight: 800; text-align: center; letter-spacing: 2px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: 18px 50%, 13px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 34px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13.5px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.switch input:checked + span { background: var(--violet); }
.switch input:checked + span::after { transform: translateX(-20px); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.stepper button { width: 40px; height: 42px; border: 0; background: transparent; cursor: pointer; font-size: 20px; color: var(--text-2); }
.stepper input { width: 64px; text-align: center; border: 0; background: transparent; font-weight: 800; height: 42px; outline: none; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--text-2); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--lime); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12.5px; color: var(--text-3); font-weight: 700; padding: 11px 14px; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; }

/* ---------------------------------------------------------------- progress */
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: inherit; transition: width .6s var(--ease); }
.bar.violet > i { background: var(--violet); }
.bar.warn > i { background: var(--warning); }
.bar.bad > i { background: var(--danger); }
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; text-align: center; line-height: 1.3; }

/* ---------------------------------------------------------------- KPI tiles */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.kpi .k-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 28px; font-weight: 900; line-height: 1.3; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12.5px; color: var(--text-3); }
.kpi svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- avatar & mascot */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; }
.jimo { display: inline-block; flex: none; }
.jimo.bounce { animation: g-bob 3s ease-in-out infinite; }

/* ---------------------------------------------------------------- modal & sheet */
.g-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(4, 6, 14, .62); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: g-fade .2s; }
.g-modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow); animation: g-pop .25s var(--ease); }
.g-modal.wide { max-width: 860px; }
.g-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.g-modal-head h3 { margin: 0; }
@media (max-width: 640px) {
  .g-overlay.sheet { align-items: flex-end; padding: 0; }
  .g-overlay.sheet .g-modal { border-radius: 24px 24px 0 0; max-height: 88vh; animation: g-up .28s var(--ease); padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- toast */
.g-toasts { position: fixed; z-index: 1000; inset-inline: 0; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.g-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 12px 16px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: g-down .3s var(--ease); }
.g-toast.ok { border-color: rgba(47, 212, 122, .5); }
.g-toast.bad { border-color: rgba(255, 77, 109, .55); }
.g-toast svg { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- states */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty svg, .empty .jimo { margin: 0 auto 12px; }
.empty h3 { color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: g-shimmer 1.3s infinite; border-radius: 10px; min-height: 16px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--text); font-size: 14px; }
.alert.warn { background: var(--warning-soft); }
.alert.bad { background: var(--danger-soft); }
.alert.ok { background: var(--success-soft); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border-strong); border-top-color: var(--violet); border-radius: 50%; animation: g-spin .8s linear infinite; }
.offline-bar { position: fixed; bottom: 0; inset-inline: 0; z-index: 950; background: var(--warning); color: #1a1200; text-align: center; font-size: 13px; font-weight: 700; padding: 6px; }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; letter-spacing: .5px; color: var(--text); text-decoration: none !important; }
.gymoo-logo { display: inline-block; flex: none; object-fit: contain; vertical-align: middle; }
.brand small { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- motion */
@keyframes g-spin { to { transform: rotate(360deg); } }
@keyframes g-fade { from { opacity: 0; } }
@keyframes g-pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes g-up { from { transform: translateY(100%); } }
@keyframes g-down { from { opacity: 0; transform: translateY(-12px); } }
@keyframes g-shimmer { to { background-position: -200% 0; } }
@keyframes g-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes g-pulse { 0% { box-shadow: 0 0 0 0 rgba(198, 255, 61, .55); } 70% { box-shadow: 0 0 0 12px rgba(198, 255, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0); } }
.fade-in { animation: g-fade .35s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Supplied GYMOO mascot: transparent assets preserve the face in both themes. */
img.gymoo-mascot { display: inline-block; flex: none; max-width: 100%; object-fit: contain; object-position: center; vertical-align: middle; user-select: none; -webkit-user-drag: none; }
img.coach-icon { width: 22px; height: 22px; }
.btn img.coach-icon, .chip img.coach-icon { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { img.gymoo-mascot.bounce { animation: none; } }
