@font-face {
  font-family: 'Peyda';
  src: url('../PeydaFaNum-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1a3358;
  --navy-dark: #0f2340;
  --gold: #b8860b;
  --gold-light: #d4a017;
  --gray-bg: #f0f2f6;
  --gray-border: #d8dde6;
  --text-dark: #1a1a1a;
  --text-mid: #5a6270;
  --green: #2e7d32;
  --red: #b00020;
  --shadow-sm: 0 1px 3px rgba(26, 51, 88, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 51, 88, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--gray-bg);
  font-family: 'Peyda', Tahoma, Arial, sans-serif;
  direction: rtl;
  color: var(--text-dark);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── هدر ── */
.app-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.app-header h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.app-header .sub {
  font-size: 13px;
  color: #b8c5d9;
  margin-top: 4px;
}

.app-header .meta {
  font-size: 13px;
  color: #e8c15a;
  text-align: left;
  line-height: 1.5;
}

/* ── لایه‌بندی ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 90px;
}

.card {
  background: #fff;
  border: 1px solid var(--gray-border);
  border-radius: 12px;
  padding: 32px 34px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
  padding-bottom: 12px;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 19px;
  font-weight: 400;
}

/* ── صفحه شروع ── */
.start-card {
  padding: 36px 38px;
}

.start-intro {
  margin-bottom: 24px;
}

.start-lead {
  color: var(--text-mid);
  font-size: 15px;
  margin: 0;
  line-height: 1.85;
}

.info-panel {
  background: #f7f9fc;
  border: 1px solid var(--gray-border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 28px;
}

.info-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 10px;
}

.info-list {
  margin: 0;
  padding: 0 20px 0 0;
  color: var(--text-mid);
  font-size: 14px;
}

.info-list li {
  margin-bottom: 6px;
  line-height: 1.75;
}

.info-list li:last-child {
  margin-bottom: 0;
}

.start-form {
  margin-top: 4px;
}

/* ── فیلدها ── */
.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14.5px;
  color: var(--text-dark);
}

.field-hint {
  display: block;
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 12px;
  font-weight: 400;
}

.field input[type=text],
.field input[type=email],
.field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type=text]:focus,
.field input[type=email]:focus,
.field select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 51, 88, 0.1);
}

.field input.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.1);
}

/* ── انتخاب موقعیت شغلی (کارت) ── */
.track-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.track-grid.track-grid-error .track-card {
  border-color: #e8a0a8;
}

.track-card {
  display: block;
  cursor: pointer;
  position: relative;
}

.track-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.track-card-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 2px solid var(--gray-border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}

.track-card:hover .track-card-body {
  border-color: #a8b4c8;
  background: #fafbfc;
}

.track-card:has(.track-radio:checked) .track-card-body {
  border-color: var(--navy);
  background: #f4f7fb;
  box-shadow: 0 0 0 3px rgba(26, 51, 88, 0.1);
}

.track-card-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-border);
  border-radius: 50%;
  margin-top: 2px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.track-card:has(.track-radio:checked) .track-card-check {
  border-color: var(--navy);
  background: var(--navy);
}

.track-card:has(.track-radio:checked) .track-card-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}

.track-card-content {
  flex: 1;
  min-width: 0;
}

.track-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.track-card-desc {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 10px;
}

.track-card-meta {
  font-size: 12px;
  color: #8a93a3;
  background: #eef1f6;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
}

.start-actions {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-border);
}

.btn-start {
  min-width: 180px;
  padding: 13px 28px;
  font-size: 15px;
}

/* ── دکمه‌ها ── */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  transition: filter 0.15s ease, transform 0.1s ease;
}

button:hover {
  filter: brightness(1.06);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}

.btn-gold {
  background: var(--gold);
  color: #fff;
}

.btn-secondary {
  background: #e9ecf2;
  color: var(--text-dark);
}

/* ── پیشرفت و ناوبری بخش‌ها ── */
.progress-wrap {
  background: #e4e9f1;
  border-radius: 20px;
  height: 6px;
  overflow: hidden;
  margin: 4px 0 24px;
}

.progress-bar {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 20px;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.section-nav .dot {
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 16px;
  background: #e9ecf2;
  color: var(--text-mid);
  border: 1px solid var(--gray-border);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.section-nav .dot:hover {
  background: #dfe4ee;
}

.section-nav .dot.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.section-nav .dot.done {
  background: #dcefe0;
  color: var(--green);
  border-color: #b7e0bf;
}

/* ── سوالات ── */
.question-block {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid #eaedf2;
}

.question-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.q-title {
  font-weight: 600;
  font-size: 15.5px;
  margin-bottom: 8px;
  line-height: 1.65;
}

.q-title .q-num {
  color: var(--gold);
  margin-left: 6px;
}

.q-sub {
  font-size: 13.5px;
  color: var(--text-mid);
  margin-bottom: 12px;
  background: #f7f5ef;
  border-right: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 6px;
  line-height: 1.75;
}

textarea {
  width: 100%;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  resize: vertical;
  line-height: 1.75;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 51, 88, 0.08);
}

textarea.code-editor {
  font-family: 'Consolas', 'Courier New', monospace;
  direction: ltr;
  text-align: left;
  background: #1e1e2e;
  color: #e8e8e8;
  font-size: 14px;
  border-color: #2a2d3a;
}

textarea.code-editor:focus {
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

.code-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.code-status {
  font-size: 13px;
  color: var(--text-mid);
}

.output-box {
  margin-top: 10px;
  background: #12131a;
  color: #a9e5a9;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13.5px;
  direction: ltr;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  min-height: 30px;
  white-space: pre-wrap;
  overflow-x: auto;
}

.output-box.error {
  color: #f28b82;
}

table.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13.5px;
  direction: ltr;
  text-align: left;
}

table.result-table th,
table.result-table td {
  border: 1px solid #444;
  padding: 6px 10px;
}

table.result-table th {
  background: #2a2d3a;
  color: #fff;
}

table.result-table td {
  background: #1e1e2e;
  color: #e8e8e8;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eaedf2;
}

/* ── تایمر ── */
.timer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--navy);
  color: #fff;
  padding: 9px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
  z-index: 50;
  letter-spacing: 0.05em;
}

/* ── صفحه پایان ── */
.done-screen {
  text-align: center;
  padding: 64px 24px;
}

.done-screen .big-check {
  font-size: 56px;
  color: var(--green);
  margin-bottom: 12px;
}

.done-screen p {
  color: var(--text-mid);
  font-size: 15px;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.85;
}

.review-summary {
  background: #f7f9fc;
  border: 1px solid var(--gray-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14.5px;
  line-height: 1.9;
}

.review-note {
  color: var(--text-mid);
  font-size: 13.5px;
  line-height: 1.8;
  margin-bottom: 0;
}

.loading-note {
  font-size: 12.5px;
  color: var(--text-mid);
  margin-top: 6px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  background: var(--gold);
  color: #fff;
  padding: 2px 9px;
  border-radius: 10px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── پیش‌نمایش داده (قبل از نوشتن کوئری/کد) ── */
.data-preview {
  margin: 4px 0 14px;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  overflow: hidden;
}

.data-preview-caption {
  font-size: 12.5px;
  color: var(--text-mid);
  background: #f7f9fc;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-border);
}

table.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  direction: ltr;
  text-align: left;
}

table.preview-table th,
table.preview-table td {
  border-bottom: 1px solid var(--gray-border);
  padding: 7px 12px;
  white-space: nowrap;
}

table.preview-table th {
  background: #eef1f6;
  color: var(--navy);
  font-weight: 600;
}

table.preview-table tr:last-child td {
  border-bottom: none;
}

table.preview-table td {
  background: #fff;
  color: var(--text-dark);
}

/* ── واکنش‌گرا ── */
@media (max-width: 640px) {
  .app-header {
    padding: 16px 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .app-header .meta {
    text-align: right;
  }

  .container {
    padding: 20px 14px 80px;
  }

  .card,
  .start-card {
    padding: 24px 20px;
  }

  .track-grid {
    grid-template-columns: 1fr;
  }

  .section-nav .dot {
    font-size: 11px;
    padding: 6px 10px;
  }
}
