/* ==========================================================================
   کی به کیه؟ | نظرسنجی کلاسی - استایل مینیمال، مدرن و موبایل‌پسند (RTL)
   ========================================================================== */

:root {
  --bg-page: #eef2f5;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-light: #e2e8f0;
  --border-hover: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --shadow-card: 0 12px 32px -4px rgba(15, 23, 42, 0.07), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-btn: 0 6px 16px -3px rgba(79, 70, 229, 0.35);
  --radius-card: 24px;
  --radius-option: 16px;
  --radius-btn: 16px;
  --font-main: 'Vazir', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-main);
  direction: rtl;
  text-align: right;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* چیدمان صفحه */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 14px 28px;
}

/* کارت سفید اصلی */
.poll-card {
  width: 100%;
  max-width: 500px;
  background-color: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 26px 22px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* هدر کارت */
.poll-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--accent-soft);
  border-radius: 12px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.step-badge {
  background-color: #f1f5f9;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
}

/* نقاط پیشرفت ۵ سوال */
.step-dots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.step-dot {
  height: 34px;
  border-radius: 10px;
  background-color: #f1f5f9;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  border: 1.5px solid transparent;
}

.step-dot:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.step-dot.voted {
  background-color: var(--success-soft);
  color: #059669;
  border-color: #a7f3d0;
}

.step-dot.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
  opacity: 1;
}

/* جعبه عنوان سوال */
.question-box {
  margin-bottom: 18px;
}

.question-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.55;
  margin-bottom: 6px;
}

.question-hint {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

/* بنر ثبت رأی */
.voted-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--success-soft);
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 10px 14px;
  border-radius: 13px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 14px;
  animation: fadeInDown 0.3s ease;
}

/* لیست ۱۰ گزینه (بزرگ و انگشتی‌پسند) */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  width: 100%;
  text-align: right;
  background-color: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-option);
  padding: 13px 15px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 56px;
  justify-content: center;
}

.option-item:not(:disabled):hover {
  border-color: var(--accent);
  background-color: #f5f7ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.option-item:not(:disabled):active {
  transform: scale(0.985);
}

.option-item:disabled {
  cursor: default;
  background-color: #ffffff;
}

.option-item.selected {
  border-color: var(--accent);
  background-color: #f8faff;
  box-shadow: 0 3px 12px rgba(79, 70, 229, 0.1);
}

.option-item.top-winner:disabled:not(.selected) {
  border-color: #cbd5e1;
}

/* ردیف بالا در هر گزینه */
.option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  z-index: 1;
}

.option-label-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.option-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: #fff;
  font-size: 0.75rem;
  color: transparent;
}

.option-item:not(:disabled):hover .option-radio {
  border-color: var(--accent);
}

.option-item.selected .option-radio {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.option-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
}

.option-stat-text {
  font-size: 0.9rem;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.option-item.show-result .option-stat-text {
  opacity: 1;
  transform: translateX(0);
}

.option-user-tag {
  font-size: 0.74rem;
  font-weight: 700;
  background-color: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
}

/* نوار پیشرفت زیر هر گزینه */
.progress-wrapper {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.option-item.show-result .progress-wrapper {
  display: flex;
}

.progress-track {
  width: 100%;
  height: 9px;
  background-color: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

/* رنگ‌های متنوع و شاد برای نوارهای پیشرفت */
.color-0 { background: linear-gradient(90deg, #6366f1, #4f46e5); }
.color-1 { background: linear-gradient(90deg, #10b981, #059669); }
.color-2 { background: linear-gradient(90deg, #f59e0b, #d97706); }
.color-3 { background: linear-gradient(90deg, #ec4899, #db2777); }
.color-4 { background: linear-gradient(90deg, #06b6d4, #0891b2); }
.color-5 { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.color-6 { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.color-7 { background: linear-gradient(90deg, #f97316, #ea580c); }
.color-8 { background: linear-gradient(90deg, #14b8a6, #0d9488); }
.color-9 { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* فوتر کارت و دکمه بعدی */
.card-footer {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.total-votes-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 10px;
}

.next-btn {
  width: 100%;
  min-height: 54px;
  background: linear-gradient(135deg, var(--accent), #4338ca);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--radius-btn);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: popUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.next-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #3730a3);
  transform: translateY(-2px);
}

.next-btn:active {
  transform: scale(0.98);
}

.next-btn.finish-mode {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 6px 16px -3px rgba(16, 185, 129, 0.38);
}

.next-btn-arrow {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.next-btn:hover .next-btn-arrow {
  transform: translateX(-4px);
}

/* صفحه پایان نظرسنجی */
.finish-view {
  text-align: center;
  padding: 18px 6px 8px;
  animation: fadeInDown 0.4s ease;
}

.finish-confetti {
  font-size: 3rem;
  margin-bottom: 10px;
  line-height: 1.2;
}

.finish-title {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}

.finish-subtitle {
  font-size: 0.96rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.summary-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 16px;
  text-align: right;
  margin-bottom: 20px;
}

.summary-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 12px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-q {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.summary-winner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.summary-winner-badge {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.review-btn {
  width: 100%;
  min-height: 50px;
  background-color: #f1f5f9;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 14px;
  padding: 12px 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.review-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

/* فوتر صفحه */
.page-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* انیمیشن‌ها */
@keyframes popUp {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* بهینه‌سازی اختصاصی موبایل */
@media (max-width: 480px) {
  .page-wrapper {
    padding: 12px 10px 22px;
    justify-content: flex-start;
  }

  .poll-card {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .question-title {
    font-size: 1.1rem;
  }

  .option-item {
    padding: 12px 13px;
    min-height: 54px;
  }

  .option-name {
    font-size: 0.98rem;
  }
}
