/* ═════════════════════════════════════════════════════════════
   theme.css — تم لایت/دارک با CSS variables
   ═════════════════════════════════════════════════════════════ */

:root {
  /* رنگ‌های تم روشن (پیش‌فرض) */
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #121212;
  --text-dim: #5F6368;
  --accent: #2E7D32;
  --accent-hover: #1B5E20;
  --border: #E0E0E0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

  /* رنگ‌های state */
  --ok: #2E7D32;
  --warn: #FFA000;
  --err: #B71C1C;
  --info: #1976D2;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Font sizes */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 36px;

  /* Layout */
  --nav-height: 64px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

/* تم تاریک */
[data-theme="dark"] {
  --bg: #0F1115;
  --card: #1A1D23;
  --text: #E8EAED;
  --text-dim: #9AA0A6;
  --accent: #4CAF50;
  --accent-hover: #66BB6A;
  --border: #2A2D34;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

  --ok: #4CAF50;
  --warn: #FFB74D;
  --err: #EF5350;
  --info: #42A5F5;
}

/* ═════ body ═════ */
body {
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

/* ═════ Layout ═════ */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-4);
}

/* ═════ Loading screen ═════ */
.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.loading-logo {
  font-size: 64px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--accent);
  margin-top: var(--space-4);
}

.loading-sub {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: var(--space-2);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

/* ═════ Utility classes ═════ */
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-dim { color: var(--text-dim); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-err { color: var(--err); }
.text-bold { font-weight: 700; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-center { display: flex; align-items: center; justify-content: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }


/* ═════ App-like Layout ═════ */

/* عرض و مرکز */
#app {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
}

/* Container فشرده‌تر */
.container {
  max-width: none;
  padding: 14px;
}

/* Header فشرده */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.header-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* کارت فشرده */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  margin-bottom: 10px;
}

/* دکمه فشرده */
.btn {
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

/* فیلد فشرده */
.input {
  padding: 11px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.label {
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

.field {
  margin-bottom: 14px;
}

/* Nav */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  height: 60px;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-dim);
  font-size: 10px;
  padding: 6px;
  text-decoration: none;
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
}

/* فاصله برای nav */
#app {
  padding-bottom: 70px;
}

/* Responsive */
@media (max-width: 420px) {
  #app { max-width: 100%; }
}

@media (min-width: 768px) {
  body { background: #E8EAED; }
  [data-theme="dark"] body { background: #0A0B0E; }
  #app { box-shadow: 0 0 60px rgba(0,0,0,0.1); }
}


/* ═════ Role Selector (دقیقاً شبیه اپ) ═════ */

.role-screen {
  min-height: 100vh;
  padding: 40px 24px 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.role-header {
  text-align: center;
  margin-bottom: 32px;
}

.role-logo {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 8px;
}

.role-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.role-subtitle {
  font-size: 13px;
  color: var(--text-dim);
}

.role-card {
  background: var(--card);
  border-radius: 10px;
  padding: 18px 14px;
  margin-bottom: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.1s, box-shadow 0.1s;
}

.role-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 1px rgba(0,0,0,0.02);
}

.role-icon {
  font-size: 44px;
  line-height: 1;
  flex-shrink: 0;
}

.role-body {
  flex: 1;
  min-width: 0;
}

.role-card-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.role-card-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.role-arrow {
  font-size: 22px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.role-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-dim);
}

.role-support {
  display: inline-block;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

/* Header با دکمه بازگشت و آیکون نقش */
.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px 0;
}

.auth-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.auth-role-icon {
  font-size: 32px;
}

/* فرم Auth */
.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

/* تب ورود/ثبت‌نام */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--border);
  border-radius: 8px;
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
}

/* فیلد با آیکون */
.auth-field {
  margin-bottom: 16px;
}

.auth-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
}

.auth-label-icon {
  font-size: 16px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Eye button */
.auth-eye-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* نوار قدرت رمز */
.auth-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  height: 4px;
}

.auth-strength-seg {
  flex: 1;
  background: var(--border);
  border-radius: 2px;
}

.auth-strength-seg.weak { background: #E53935; }
.auth-strength-seg.medium { background: #FFA726; }
.auth-strength-seg.strong { background: #4CAF50; }

/* Checkbox قوانین */
.auth-terms {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
}

.auth-terms-box {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.auth-terms-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

/* Captcha */
.auth-captcha {
  padding: 12px 0;
}

.auth-captcha-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-align: right;
}

.auth-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-captcha-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.auth-captcha-input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}

/* دکمه اصلی */
.auth-submit {
  margin-top: 20px;
}

/* فراموشی رمز */
.auth-forgot {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
}
