/* ==========================================================================
   Dark Trading-Terminal Theme (Self-Contained Stylesheet)
   ========================================================================== */
:root {
  --bg-base: #0b0e11;
  --bg-surface: #181a20;
  --bg-surface-elevated: #1e2329;
  --bg-input: #14171c;
  --border-subtle: #2b3139;
  --border-focus: #f0b90b;
  --gold-primary: #f0b90b;
  --gold-hover: #fcd535;
  --gold-tint: rgba(240, 185, 11, 0.12);
  --text-primary: #eaecef;
  --text-secondary: #848e9c;
  --text-dark: #0b0e11;
  --green-ok: #0ecb81;
  --green-tint: rgba(14, 203, 129, 0.12);
  --red-err: #f6465d;
  --red-tint: rgba(246, 70, 93, 0.12);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans CJK TC", "Noto Sans Arabic", Arial, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Subtle Trading Grid & Radial Ambient Glow */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(43, 49, 57, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(43, 49, 57, 0.22) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: -2;
}

.bg-glow {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 860px;
  height: 460px;
  background: radial-gradient(circle, rgba(240, 185, 11, 0.12) 0%, rgba(11, 14, 17, 0) 70%);
  pointer-events: none;
  z-index: -1;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 17, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-primary);
}

.lang-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.ip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-ok);
  box-shadow: 0 0 6px var(--green-ok);
}

.lang-select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.lang-select:focus {
  border-color: var(--gold-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--gold-primary);
  border-color: var(--gold-primary);
}

/* Main Container */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* Hero Card */
.hero-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, #14171d 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-primary);
  background: var(--gold-tint);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero-card h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 620px;
}

.hero-visual img {
  width: 150px;
  height: 110px;
  display: block;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.step-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-tab.active {
  background: var(--bg-surface-elevated);
  border-color: var(--gold-primary);
  color: var(--text-primary);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-tab.active .step-num {
  background: var(--gold-primary);
  color: var(--text-dark);
  font-weight: 700;
}

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Progress Bar */
.progress-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 22px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background: var(--bg-base);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Question Cards */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.q-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color 0.2s ease;
}

.q-card.answered {
  border-color: rgba(240, 185, 11, 0.45);
}

.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.q-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-primary);
  background: var(--gold-tint);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

.q-index {
  font-size: 12px;
  color: var(--text-secondary);
}

.q-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.option-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.option-label:hover {
  border-color: #474d57;
  background: var(--bg-surface-elevated);
}

.option-label.selected {
  border-color: var(--gold-primary);
  background: var(--gold-tint);
}

.option-label input[type="radio"] {
  accent-color: var(--gold-primary);
  margin-top: 3px;
}

/* Registration Form */
.card-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}

.section-title {
  font-size: 19px;
  margin-bottom: 6px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.form-input:focus {
  border-color: var(--gold-primary);
}

.compliance-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gold-tint);
  border: 1px solid rgba(240, 185, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.compliance-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 18px;
}

.checkbox-row input {
  accent-color: var(--gold-primary);
  margin-top: 3px;
}

/* Buttons & Footer Actions */
.panel-footer {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-footer.split {
  justify-content: space-between;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-primary);
  color: var(--text-dark);
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--gold-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
}

.validation-msg {
  color: var(--red-err);
  font-size: 13px;
  font-weight: 500;
}

/* Results View */
.result-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.result-score-card {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--gold-primary);
  background: var(--gold-tint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.score-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold-primary);
}

.score-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.badge-gold {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-primary);
  background: var(--gold-tint);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.ref-box {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.ref-box code {
  color: var(--gold-primary);
  font-weight: 700;
}

.btn-copy {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.review-item.correct {
  border-left: 4px solid var(--green-ok);
}

.review-item.incorrect {
  border-left: 4px solid var(--red-err);
}

.review-item.neutral {
  border-left: 4px solid var(--gold-primary);
}

.review-exp {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
}

.hidden {
  display: none !important;
}

/* RTL Support for Arabic */
html[dir="rtl"] .review-item.correct {
  border-left: 1px solid var(--border-subtle);
  border-right: 4px solid var(--green-ok);
}

html[dir="rtl"] .review-item.incorrect {
  border-left: 1px solid var(--border-subtle);
  border-right: 4px solid var(--red-err);
}

html[dir="rtl"] .review-item.neutral {
  border-left: 1px solid var(--border-subtle);
  border-right: 4px solid var(--gold-primary);
}

@media (max-width: 680px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .step-tab span:last-child {
    font-size: 12px;
  }
}
