@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: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --primary: #bb0b23;
  --primary-600: #f1380c;
  --green: #16a34a;
  --yellow: #eab308;
  --red: #dc2626;
  --shadow: 0 4px 20px rgba(15,23,42,.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[dir="ltr"] body { text-align: left; }

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




/* Main */
.main { flex: 1; padding: 28px 20px; }
.hero {
  margin: 16px 0 28px;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: start;
}

.hero-text {
  max-width: 680px;
}

.hero h1 {
  font-size: 26px;
  line-height: 1.4;
  margin: 0 0 8px;
}

.hero p {
  color: var(--muted);
  margin: 0;
  line-height: 1.8;
}

.hero-logo-wrap {
  flex: 0 0 auto;
}

.hero-logo {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
}

@media (max-width: 768px) {
  .hero {
    margin: 14px 0 24px;
  }

  .hero-content {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }

  .hero-logo {
    width: 96px;
    height: 96px;
  }

  .hero h1 {
    font-size: 22px;
  }
}

.layout {
  display: grid; gap: 20px;
  grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; font-size: 18px; }

/* general field styles */
.field {
  margin-bottom: 1.25rem; /* 20px */
  position: relative; /* برای قرارگیری پیام خطا */
}

.field label {
  display: block; /* لیبل در خط خودش */
  margin-bottom: 0.5rem; /* 8px */
  font-weight: 600;
  font-size: 0.9375rem; /* 15px */
  color: #374151; /* رنگ متنی تیره‌تر */
}

.field .range-hint {
  display: block; /* hint هم در خط خودش */
  font-size: 0.82em;
  font-weight: 400;
  color: #6B7280; /* خاکستری */
  margin-bottom: 0.25rem; /* 4px */
}

/* input field styling */
.field input[type="number"],
.field input[type="text"], /* اضافه شده برای انواع دیگر ورودی */
.field select { /* اضافه شده برای select box ها */
  width: 100%;
  padding: 0.75rem 0.875rem; /* 12px 14px */
  border: 1px solid #d1d5db; /* خاکستری روشن */
  border-radius: 6px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 0.9375rem; /* 15px */
  color: #1f2937; /* متن ورودی تیره‌تر */
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.field input[type="number"]:focus,
.field input[type="text"]:focus,
.field select:focus {
  border-color: #3b82f6; /* آبی در حالت فوکوس */
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3); /* سایه آبی ملایم */
}

/* invalid state */
.field .is-invalid {
  border-color: #dc2626 !important; /* قرمز برای خطا */
  outline: none !important; /* حذف outline پیش‌فرض */
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.3); /* سایه قرمز ملایم */
}

.field .field-error {
  display: block;
  min-height: 18px;
  margin-top: 0.5rem; /* 8px */
  font-size: 0.82rem; /* 13px */
  color: #dc2626; /* قرمز */
}

/* styling for radio buttons and checkboxes */
.radio-row {
  display: flex;
  gap: 1.5rem; /* 24px */
  flex-wrap: wrap;
  margin-top: 0.5rem; /* 8px */
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem; /* 8px */
  margin-bottom: 0;
  font-weight: 400;
  font-size: 0.9375rem; /* 15px */
  color: #374151;
  cursor: pointer;
}

.radio-row input[type="radio"],
.radio-row input[type="checkbox"] {
  /* اینجا می‌توانید ظاهر رادیوباکس‌ها/چک‌باکس‌ها را سفارشی کنید */
  /* مثال: */
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary); /* رنگ اصلی رادیوباکس/چک‌باکس */
  cursor: pointer;
}

.radio-row input[type="radio"]:focus,
.radio-row input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.radio-row .is-invalid input[type="radio"],
.radio-row .is-invalid input[type="checkbox"] {
  accent-color: #dc2626; /* رنگ قرمز در صورت خطا */
}
  .actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
  }



/* placeholder styling */
.field input::placeholder {
  color: #9CA3AF; /* خاکستری ملایم */
  opacity: 1; /* اطمینان از نمایش کامل */
}

.field input:focus::placeholder {
  color: #6B7280; /* کمی تیره‌تر در فوکوس */
}


/* grid layout for two columns */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem; /* 20px */
}

/* Responsive adjustments for grid */
@media (max-width: 768px) { /* در تبلت ها یا کوچکتر */
  .grid-2 {
    grid-template-columns: 1fr; /* تک ستونه */
  }
}

.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }

.actions { display: flex; gap: 10px; margin-top: 18px; }
.btn-primary, .btn-ghost {
  font: inherit; cursor: pointer; padding: 10px 18px; border-radius: 10px;
  border: 1px solid transparent; transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #f1f5f9; }

/* Results */
.results { display: flex; flex-direction: column; gap: 16px; }
.placeholder { color: var(--muted); text-align: center; }

.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.result-card h3 { margin: 0 0 4px; font-size: 20px; color: var(--text); font-weight: 500; }
.risk-value { font-size: 40px; font-weight: 700; color: var(--primary); margin: 6px 0 14px; }
.risk-value.iran { color: #0ea5e9; }

.lights { display: grid; gap: 10px; }
.light-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border);
}
.light-row .name { font-size: 13px; }
.light-row .badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.badge.low { background: #dcfce7; color: #166534; } .badge.low .dot { background: var(--green); }
.badge.mid { background: #fef9c3; color: #854d0e; } .badge.mid .dot { background: var(--yellow); }
.badge.high{ background: #fee2e2; color: #991b1b; } .badge.high .dot { background: var(--red); }

.note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0; background: #fff; margin-top: 30px;
  font-size: 13px; color: var(--muted); text-align: center;
}
.site-footer a { color: var(--primary); text-decoration: none; }

/* About */
.prose h1 { font-size: 24px; margin-top: 0; }
.prose h2 { font-size: 17px; margin-top: 22px; }
.prose p { color: #334155; }

/* LTR adjustments */
[dir="ltr"] .brand { flex-direction: row; }


.gauge-box {
    width: 100%;
    background: #e9ecef;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}
.gauge-bar {
    height: 100%;
    transition: width 0.5s ease-in-out;
}
.gauge-text {
    text-align: center;
    font-weight: bold;
    margin-top: 5px;
}
.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.invalid-feedback {
  display: block;
  margin-top: 6px;
  color: #dc2626;
  font-size: 0.875rem;
  line-height: 1.5;
}

.risk-gauge-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.risk-gauge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.risk-gauge-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.risk-gauge-value {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
  direction: ltr;
}

.risk-gauge-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #16a34a 0%,
    #16a34a 25%,
    #facc15 25%,
    #facc15 50%,
    #f97316 50%,
    #f97316 75%,
    #dc2626 75%,
    #dc2626 100%
  );
  overflow: visible;
  margin: 26px 0 14px;
}

[dir="rtl"] .risk-gauge-track {
  background: linear-gradient(
    to left,
    #16a34a 0%,
    #16a34a 25%,
    #facc15 25%,
    #facc15 50%,
    #f97316 50%,
    #f97316 75%,
    #dc2626 75%,
    #dc2626 100%
  );
}


.risk-gauge-marker {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 34px;
  border-radius: 999px;
  background: #0f172a;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.12);
}

html[dir="rtl"] .risk-gauge-marker {
  transform: translate(50%, -50%);
}

.risk-gauge-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.risk-gauge-label {
  border-radius: 14px;
  padding: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.85rem;
  line-height: 1.7;
  text-align: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.risk-gauge-label strong {
  display: block;
  color: #0f172a;
  font-size: 0.95rem;
}

.risk-gauge-label.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.risk-gauge-note {
  margin: 18px 0 0;
  color: #64748b;
  line-height: 1.8;
}

.field-error {
  margin-top: 6px;
  color: #dc2626;
  font-size: 0.82rem;
  line-height: 1.6;
}

.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

@media (max-width: 640px) {
  .risk-gauge-head {
    display: block;
  }

  .risk-gauge-value {
    margin-top: 8px;
    display: block;
  }


}


/* ===============================
   About Page
================================ */

.about-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  line-height: 1.9;
  font-size: 15px;
  color: #1f2937;
}


/* ===============================
   Headings
================================ */

.about-page h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 22px;
  color: var(--text);
}

.about-page h2 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 42px;
  margin-bottom: 14px;
  color: var(--text);
  position: relative;
  padding-bottom: 8px;
}

.about-page h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 50px;
  height: 4px;
  background: var(--primary);
  border-radius: 3px;
}

/* ===============================
   Paragraphs
================================ */

.about-page p {
  margin-bottom: 16px;
  text-align: justify;
}


/* ===============================
   Scientific references
================================ */

.reference {
  margin-top: 12px;
  padding: 14px 16px;
  background: #fff2f4;
  border-left: 4px solid  var(--primary);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.8;
  direction: ltr;
}

.reference a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-word;
}

.reference a:hover {
  text-decoration: underline;
}


/* ===============================
   Contact info
================================ */

.about-page strong {
  font-weight: 600;
  color: #111827;
}

.about-page a {
  color: var(--primary);
  text-decoration: none;
}

.about-page a:hover {
  text-decoration: underline;
}


/* ===============================
   Version block
================================ */

.about-page p span:last-child {
  margin-right: 6px;
}


/* ===============================
   Spacing tweaks
================================ */

.about_contact_block p {
  margin-bottom: 10px;
}


/* ===============================
   RTL / LTR support
================================ */



html[dir="rtl"] .about-page {
  text-align: right;
}

html[dir="ltr"] .about-page {
  text-align: left;
}


/* ===============================
   Mobile
================================ */

@media (max-width: 768px) {

  .about-page {
    padding: 28px 16px 48px;
    font-size: 14px;
  }

  .about-page h1 {
    font-size: 22px;
  }

  .about-page h2 {
    font-size: 18px;
  }

  .reference {
    font-size: 13px;
  }

}



/* ===============================
   HEADER (Desktop default)
=================================*/
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;

  /* عناصر را به دو طرف کشیده و بین آن‌ها فاصله بینداز */
  justify-content: space-between;

  /* اگر می‌خواهی هدر عرض محدودی داشته باشد (مثلاً 1200px) */
  max-width: 1200px; 
  margin: 0 auto; /* وسط‌چین کردن هدر */
  padding: 12px 24px; /* فضای داخلی */
  min-height: 80px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 64px;
  height: 64px;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.desktop-nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
}

.desktop-nav a:hover {
  color: var(--primary);
}

/* استایل مشترک دکمه‌های حاوی پرچم */
.lang-btn, .lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
}

/* تنظیم ابعاد پرچم */
.flag-img {
  width: 24px;
  height: 18px; /* نسبت ابعاد استاندارد پرچم‌ها معمولا 4:3 یا 3:2 است */
  object-fit: cover;
  border-radius: 2px; /* گرد کردن خفیف لبه‌های پرچم جهت زیبایی */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); /* سایه بسیار ملایم دور پرچم */
}

/* تراز بودن آیکون در منوی پایین موبایل */
.bottom-nav .lang-switch {
  flex-direction: column; /* چینش عمودی تصویر و متن در موبایل */
  gap: 4px;
  font-size: 0.72rem;
  font-family: 'Vazirmatn';
}

/* ===============================
   BOTTOM NAV (Desktop hidden)
=================================*/
.bottom-nav {
  display: none;
}

/* ===============================
   MOBILE LAYOUT
=================================*/
@media (max-width: 768px) {

  /* دسکتاپ منو مخفی */
  .desktop-nav {
    display: none;
  }

  /* header */
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    height: 80px;
    z-index: 1000;
  }

  .header-inner {
    height: 60px;
    padding: 0 16px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .brand-title {
    font-size: 14px;
  }

  /* bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: #fff;
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
  }

  .nav-item {
    flex: 1;
    text-align: center;
    font-size: 10px;
    text-decoration: none;
    color: var(--muted);
  }

  .nav-icon {
    width: 22px;
    height: 22px;
    display: block;
    margin: auto;
  }

  .nav-text {
    font-size: 12px;
  }

  body {
    padding-top: 60px;
    padding-bottom: 70px;
  }
}
