@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════
   VARIABLES & RESET — Mobile First
══════════════════════════════════════ */
#mos-survey-wrap {
  --ink:#0D0D0D; --ink-mid:#2A2A2A; --ink-light:#5A5A5A; --ink-faint:#9A9A9A;
  --bg:#F4F2ED; --bg-card:#FAFAF7; --bg-block:#EEECE8; --rule:#D8D6D0;
  --accent:#1A3A5C; --accent-light:#E8EFF7; --gold:#8A7A50;
  --green:#2D6A4F; --green-light:#E8F4EE; --red:#8B2020; --red-light:#F4E8E8;
  --radius:10px; --nav-h:68px;
  --touch-min: 48px; /* حداقل اندازه touch target */

  font-family:'Vazirmatn',Tahoma,sans-serif;
  background:var(--bg); color:var(--ink);
  direction:rtl;
  /* موبایل فرست: فونت بزرگتر */
  font-size:16px;
  line-height:1.8;
  padding:20px 16px calc(var(--nav-h) + 24px);
}
#mos-survey-wrap * { box-sizing:border-box; margin:0; padding:0; }

/* ── header ── */
.mos-header { max-width:720px; margin:0 auto 24px; text-align:center; }
.mos-badge {
  display:inline-flex; align-items:center; gap:8px;
  border:1.5px solid var(--accent); color:var(--accent);
  font-size:11px; font-weight:800; letter-spacing:1px;
  padding:6px 18px; border-radius:20px; margin-bottom:16px; text-transform:uppercase;
}
.mos-badge::before { content:'◆'; font-size:9px; color:var(--gold); }

/* موبایل فرست: تایتل بزرگ‌تر */
.mos-title { font-size:22px; font-weight:900; color:var(--ink); margin-bottom:10px; line-height:1.4; }
.mos-subtitle { font-size:15px; color:var(--ink-light); line-height:1.9; max-width:540px; margin:0 auto 20px; }
.mos-meta { display:flex; justify-content:center; gap:8px; flex-wrap:wrap; }
.mos-chip {
  display:inline-flex; align-items:center; gap:5px;
  background:var(--bg-card); border:1px solid var(--rule);
  border-radius:20px; padding:6px 14px; font-size:13px; color:var(--ink-light); font-weight:600;
}
.mos-chip span { color:var(--accent); font-weight:700; }

/* ── progress ── */
.mos-progress-wrap { max-width:720px; margin:0 auto 24px; }
.mos-progress-label { display:flex; justify-content:space-between; font-size:13px; font-weight:700; color:var(--ink-faint); margin-bottom:8px; }
.mos-progress-bar { height:6px; background:var(--rule); border-radius:4px; overflow:hidden; }
.mos-progress-fill { height:100%; background:linear-gradient(90deg,var(--accent),var(--gold)); border-radius:4px; transition:width .4s ease; width:0%; }

/* ── sections ── */
.mos-sec {
  max-width:720px; margin:0 auto 20px;
  background:var(--bg-card); border:1px solid var(--rule);
  border-top:3px solid var(--accent); border-radius:var(--radius);
  overflow:hidden; display:none;
  animation:mosFadeIn .3s ease;
}
.mos-sec.active { display:block; }
@keyframes mosFadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.mos-sec-header {
  background:var(--bg-block); border-bottom:1px solid var(--rule);
  padding:16px 20px; display:flex; align-items:center; gap:14px;
}
.mos-sec-num {
  width:36px; height:36px; background:var(--accent); color:#fff;
  font-size:15px; font-weight:800; border-radius:50%;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.mos-sec-title { font-size:16px; font-weight:800; color:var(--ink); }
.mos-sec-desc { font-size:13px; color:var(--ink-light); margin-top:3px; line-height:1.5; }

.mos-questions { padding:20px 20px; display:flex; flex-direction:column; gap:28px; }
.mos-q { display:flex; flex-direction:column; gap:12px; }

/* لیبل سوال — بزرگ‌تر و خواناتر */
.mos-q-label { font-size:15px; font-weight:700; color:var(--ink); line-height:1.6; }
.mos-req { color:var(--red); margin-right:2px; }
.mos-hint { font-size:13px; color:var(--ink-faint); font-weight:400; }
.mos-note {
  background:var(--accent-light); border:1px solid #C8D8E8;
  border-radius:6px; padding:10px 14px; font-size:13px; color:var(--accent); font-weight:600;
  line-height:1.7;
}

/* ── select ── */
.mos-select {
  width:100%;
  /* حداقل ارتفاع touch target */
  min-height:var(--touch-min);
  padding:12px 16px;
  background:var(--bg-block); border:1.5px solid var(--rule);
  border-radius:8px; font-family:'Vazirmatn',Tahoma,sans-serif;
  font-size:16px; /* جلوگیری از zoom در iOS */
  color:var(--ink); outline:none; cursor:pointer; direction:rtl;
}
.mos-select:focus { border-color:var(--accent); }

/* ── options (radio/checkbox) ── */
.mos-opts { display:flex; flex-direction:column; gap:10px; }
.mos-opt {
  display:flex; align-items:flex-start; gap:14px;
  /* حداقل ارتفاع touch target */
  min-height:var(--touch-min);
  padding:13px 16px;
  background:var(--bg-block); border:1.5px solid var(--rule);
  border-radius:8px; cursor:pointer; transition:all .15s; user-select:none;
}
.mos-opt:hover { border-color:var(--accent); background:var(--accent-light); }
.mos-opt.selected { border-color:var(--accent); background:var(--accent-light); }
.mos-opt input { display:none; }
.mos-opt-mark {
  width:22px; height:22px; border:2px solid var(--rule); border-radius:50%;
  flex-shrink:0; margin-top:2px;
  display:flex; align-items:center; justify-content:center; transition:all .15s;
}
.mos-opt.selected .mos-opt-mark { background:var(--accent); border-color:var(--accent); }
.mos-opt.selected .mos-opt-mark::after { content:''; width:8px; height:8px; background:#fff; border-radius:50%; display:block; }
.mos-opt-check { border-radius:5px; }
.mos-opt.selected .mos-opt-check::after {
  content:''; width:10px; height:7px;
  border-left:2.5px solid #fff; border-bottom:2.5px solid #fff;
  transform:rotate(-45deg); display:block; margin:2px 0 0 3px;
}
/* متن گزینه — خواناتر */
.mos-opt-text { font-size:15px; color:var(--ink-mid); line-height:1.6; }

/* ── scale buttons ── */
.mos-scale-wrap { display:flex; flex-direction:column; gap:10px; }
.mos-scale-labels { display:flex; justify-content:space-between; font-size:12px; color:var(--ink-faint); font-weight:600; }
.mos-scale-btns { display:flex; gap:6px; flex-wrap:wrap; }
.mos-scale-btn {
  flex:1; min-width:44px; max-width:64px;
  /* touch target مناسب */
  height:50px;
  background:var(--bg-block); border:1.5px solid var(--rule);
  border-radius:8px; font-size:15px; font-weight:700;
  color:var(--ink-mid); cursor:pointer; transition:all .15s;
  font-family:'Vazirmatn',Tahoma,sans-serif;
  /* حذف استایل پیش‌فرض مرورگر */
  -webkit-appearance:none; appearance:none;
  touch-action:manipulation;
}
.mos-scale-btn:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-light); }
.mos-scale-btn.selected { background:var(--accent); border-color:var(--accent); color:#fff; }

/* ── scale 10-button (امتیاز کلی) ── */
.mos-scale-btns--10 { gap:5px; }
.mos-scale-btns--10 .mos-scale-btn {
  min-width:36px;
  max-width:52px;
  height:50px;
  font-size:14px;
}

/* ══════════════════════════════════════
   جدول مقایسه — بازطراحی موبایل‌فرست
   روی موبایل جدول تبدیل به کارت می‌شه
══════════════════════════════════════ */
.mos-compare-table-wrap { width:100%; }

/* حالت دسکتاپ — جدول معمولی */
.mos-compare-table { width:100%; border-collapse:collapse; font-size:14px; }
.mos-compare-table th {
  background:var(--bg-block); padding:10px 12px;
  font-weight:800; color:var(--ink); border:1px solid var(--rule); text-align:center;
  font-size:14px;
}
.mos-compare-table th:first-child { text-align:right; }
.mos-compare-table td { padding:10px 12px; border:1px solid var(--rule); color:var(--ink-mid); }
.mos-compare-table td:first-child { font-weight:600; font-size:14px; }
.mos-compare-table tr:nth-child(even) td { background:var(--bg-block); }
.mos-compare-table .rate-cell { text-align:center; }

/* ستاره‌ها */
.mos-stars { display:flex; justify-content:center; gap:4px; }
.mos-star {
  width:34px; height:34px;
  background:var(--bg-block); border:1.5px solid var(--rule);
  border-radius:5px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:16px; transition:all .15s; color:var(--ink-faint);
  touch-action:manipulation;
}
.mos-star:hover,.mos-star.on { background:#FFF3CD; border-color:#F0C040; color:#C0900A; }

/* ── textarea ── */
.mos-textarea {
  width:100%; min-height:100px; padding:14px 16px;
  background:var(--bg-block); border:1.5px solid var(--rule);
  border-radius:8px; font-family:'Vazirmatn',Tahoma,sans-serif;
  font-size:16px; /* جلوگیری از zoom در iOS */
  color:var(--ink); resize:vertical; outline:none;
  transition:border-color .15s; direction:rtl; line-height:1.8;
}
.mos-textarea:focus { border-color:var(--accent); background:var(--bg-card); }
.mos-textarea::placeholder { color:var(--ink-faint); font-size:14px; }

/* ── error ── */
.mos-err {
  max-width:720px; margin:0 auto 8px;
  background:var(--red-light); border:1px solid #D8A0A0;
  border-radius:8px; padding:14px 18px;
  font-size:15px; color:var(--red); font-weight:600; display:none;
}

/* ── result ── */
.mos-result {
  max-width:720px; margin:0 auto; display:none; text-align:center;
  padding:48px 24px; background:var(--bg-card);
  border:1px solid var(--rule); border-top:3px solid var(--green);
  border-radius:var(--radius); animation:mosFadeIn .5s ease;
}
.mos-result.active { display:block; }
.mos-result-icon { font-size:60px; margin-bottom:16px; }
.mos-result-title { font-size:24px; font-weight:900; color:var(--ink); margin-bottom:10px; }
.mos-result-msg { font-size:15px; color:var(--ink-light); max-width:420px; margin:0 auto; line-height:1.9; }

/* ══════════════════════════════════════
   NAV — FIXED به پایین viewport
══════════════════════════════════════ */
.mos-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h, 68px);
  background: #F4F2ED;
  border-top: 1.5px solid #D8D6D0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.10);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, calc(50vw - 360px));
}
.mos-counter { font-size:13px; font-weight:700; color:#9A9A9A; white-space:nowrap; }

/* ── دکمه‌های nav ── */
.mos-btn {
  display:inline-flex; align-items:center; gap:8px;
  /* touch target مناسب */
  min-height:var(--touch-min);
  padding:12px 24px; border-radius:8px;
  font-family:'Vazirmatn',Tahoma,sans-serif;
  font-size:15px; font-weight:700;
  cursor:pointer; border:none; transition:all .2s; white-space:nowrap;
  touch-action:manipulation; -webkit-appearance:none;
}
.mos-btn-primary { background:#1A3A5C; color:#fff; }
.mos-btn-primary:hover { background:#0F2A45; }
.mos-btn-secondary { background:#FAFAF7; color:#2A2A2A; border:1.5px solid #D8D6D0; }
.mos-btn-secondary:hover { border-color:#2A2A2A; }
.mos-btn-submit { background:#2D6A4F; color:#fff; padding:12px 28px; }
.mos-btn-submit:hover { background:#1E4D38; }
.mos-btn:disabled { opacity:.5; cursor:not-allowed; }

.mos-already-done {
  max-width:720px; margin:0 auto; padding:32px; text-align:center;
  background:#FAFAF7; border-radius:8px;
  border:1px solid #D8D6D0; font-size:15px; color:#5A5A5A;
}

/* ── v2 — warm section ── */
.mos-sec-header--warm { background: #FFF5F0; border-bottom-color: #F5D5C8; }
.mos-sec-num--warm { background: #B85C38; }
.mos-note--warm { background: #FFF5F0; border-color: #F5D5C8; color: #8B3A1A; }

/* ── v2 — green section ── */
.mos-sec-header--green { background: #F0FAF4; border-bottom-color: #C8E8D0; }
.mos-sec-num--green { background: #2D6A4F; }
.mos-note--green { background: #F0FAF4; border-color: #C8E8D0; color: #1A4A30; }

/* ══════════════════════════════════════
   MOBILE — جدول مقایسه به کارت تبدیل می‌شه
   این مهم‌ترین بهبود موبایل است
══════════════════════════════════════ */
@media (max-width: 600px) {

  #mos-survey-wrap {
    padding: 16px 14px calc(var(--nav-h) + 20px);
    font-size: 16px;
  }

  .mos-title { font-size: 20px; }
  .mos-subtitle { font-size: 14px; }
  .mos-chip { font-size: 12px; padding: 5px 12px; }

  .mos-sec-header { padding: 14px 16px; gap: 12px; }
  .mos-sec-num { width:32px; height:32px; font-size:14px; }
  .mos-sec-title { font-size: 15px; }
  .mos-sec-desc { font-size: 12px; }

  .mos-questions { padding: 16px 14px; gap: 24px; }
  .mos-q-label { font-size: 15px; }
  .mos-hint { font-size: 13px; }

  /* دکمه‌های scale روی موبایل */
  .mos-scale-btn {
    min-width: 40px;
    height: 50px;
    font-size: 15px;
  }

  /* scale 10 — دو ردیف پنج‌تایی */
  .mos-scale-btns--10 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  .mos-scale-btns--10 .mos-scale-btn {
    min-width: unset;
    max-width: unset;
    width: 100%;
    height: 52px;
    font-size: 16px;
  }

  /* ══ جدول مقایسه: تبدیل به کارت‌های عمودی ══ */
  .mos-compare-table thead { display: none; }
  .mos-compare-table, .mos-compare-table tbody,
  .mos-compare-table tr, .mos-compare-table td {
    display: block;
    width: 100%;
  }
  .mos-compare-table tr {
    background: var(--bg-card);
    border: 1.5px solid var(--rule);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
  }
  .mos-compare-table tr:nth-child(even) td { background: var(--bg-card); }

  /* ردیف معیار — عنوان کارت */
  .mos-compare-table td:first-child {
    background: var(--bg-block);
    border-bottom: 1px solid var(--rule);
    font-size: 14px;
    font-weight: 800;
    padding: 10px 14px;
    color: var(--ink);
  }

  /* سلول‌های امتیاز — نمایش با برچسب */
  .mos-compare-table td.rate-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--rule);
    min-height: 52px;
  }
  .mos-compare-table td.rate-cell:last-child {
    border-bottom: none;
  }

  /* برچسب پلتفرم روی موبایل */
  .mos-compare-table td.rate-cell::before {
    content: attr(data-label);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-light);
    white-space: nowrap;
    margin-left: 8px; /* RTL: margin-left */
    flex-shrink: 0;
  }

  .mos-stars { gap: 5px; }
  .mos-star {
    width: 38px; height: 38px;
    font-size: 18px;
    border-radius: 6px;
  }

  .mos-nav { padding: 0 14px; height: var(--nav-h); }
  .mos-btn {
    padding: 11px 18px;
    font-size: 14px;
    min-height: 46px;
  }
  .mos-counter { font-size: 12px; }

  .mos-textarea { font-size: 16px; min-height: 90px; }
}

/* ── صفحات خیلی کوچک (320px) ── */
@media (max-width: 360px) {
  .mos-btn { padding: 10px 14px; font-size: 13px; }
  .mos-scale-btns--10 .mos-scale-btn { height: 46px; font-size: 14px; }
  .mos-star { width: 34px; height: 34px; font-size: 16px; }
}

/* ── دسکتاپ (بالای ۷۲۰) ── */
@media (min-width: 720px) {
  #mos-survey-wrap {
    padding: 32px 20px calc(var(--nav-h) + 32px);
  }
  .mos-title { font-size: 26px; }
  .mos-questions { padding: 24px 28px; gap: 30px; }
  .mos-sec-header { padding: 18px 28px; }
}
