/* ═══════════════════════════════════════════════
   FxMath RL Studio — Interactive Guide Style
   ═══════════════════════════════════════════════ */

:root {
  --bg:          #1e1e2e;
  --bg2:         #181825;
  --bg3:         #11111b;
  --surface:     #313244;
  --surface2:    #45475a;
  --text:        #cdd6f4;
  --text2:       #a6adc8;
  --text3:       #6c7086;
  --accent:      #89b4fa;
  --green:       #34d399;
  --red:         #f472b6;
  --yellow:      #f9e2af;
  --purple:      #a78bfa;
  --orange:      #f59e0b;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #11111b;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* ─── APP SIMULATOR WRAPPER ────────────────── */
.app-wrapper {
  width: 1300px;
  max-width: 100%;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--surface);
  position: relative;
}

/* Title Bar */
.app-titlebar {
  background: linear-gradient(135deg, #181825, #1e1e2e);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--surface);
  font-size: 13px;
  user-select: none;
}
.titlebar-icon { font-size: 16px; }
.titlebar-text {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}
.titlebar-actions {
  color: var(--text3);
  font-size: 14px;
  cursor: default;
}

/* Body */
.app-body {
  display: flex;
  gap: 8px;
  padding: 8px;
}

/* Left Panel */
.left-panel {
  width: 340px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Right Panel */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* ─── SECTION CARDS ───────────────────────── */
.section-card {
  background: var(--bg2);
  border: 1px solid var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.section-title-bar {
  background: var(--surface);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-icon { font-size: 12px; }

.section-body {
  padding: 8px 10px;
}

/* ─── FORM ROWS ───────────────────────────── */
.form-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.form-row label {
  width: 80px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  flex-shrink: 0;
}

.inp {
  background: var(--surface2);
  border: 1px solid #585b70;
  color: var(--text);
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  outline: none;
  flex: 1;
  min-width: 0;
}
.inp:focus {
  border-color: var(--accent);
}
.inp-short { max-width: 70px; }
.inp-wide { max-width: 140px; }

select.inp {
  appearance: none;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%23cdd6f4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

/* ─── BUTTONS ─────────────────────────────── */
.btn-sm {
  background: var(--surface);
  border: 1px solid var(--surface2);
  color: var(--text2);
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-sm:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-connect {
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  background: #2e8b57;
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.btn-connect:hover { background: #3ca86a; }

/* Controls */
.controls-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.btn-ctrl {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--surface2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  font-family: inherit;
}
.btn-ctrl:hover {
  background: var(--surface2);
  border-color: var(--accent);
}
.btn-ctrl:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.btn-start {
  background: #45475a;
  border-color: var(--accent);
}
.btn-live:disabled { border-color: var(--surface2); }

/* Parameters Grid */
.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 6px;
}
.param-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.param-item label {
  font-size: 10px;
  color: var(--text3);
  width: 50px;
  flex-shrink: 0;
}
.param-item .inp { width: 60px; flex: none; }
.param-wide {
  grid-column: 1 / -1;
}
.param-wide .inp { flex: 1; width: auto; }

/* Stats */
.stats-area {
  padding: 6px 10px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
}
.stat-label { color: var(--text3); }
.stat-value {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Support */
.support-area {
  padding: 4px 10px;
}
.support-row {
  display: flex;
  gap: 6px;
  font-size: 10px;
  padding: 2px 0;
}
.sup-label { color: var(--text3); width: 50px; }
.sup-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: default;
}

/* ─── LOG AREA ────────────────────────────── */
.log-area {
  height: 140px;
  overflow-y: auto;
  background: var(--bg3);
  padding: 6px 8px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 10px;
  line-height: 1.6;
}
.log-line { color: var(--text2); }
.log-time { color: var(--text3); margin-right: 4px; }
.log-info { color: var(--text2); }
.log-system { color: var(--yellow); }

/* ─── CHART ───────────────────────────────── */
.chart-card { flex: 1; }
.chart-area {
  padding: 6px;
  background: var(--bg3);
}
.chart-svg {
  width: 100%;
  height: 180px;
  display: block;
}
.chart-line {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawChart 2s ease-out forwards;
}
@keyframes drawChart {
  to { stroke-dashoffset: 0; }
}
.chart-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 4px 6px 0;
}
.chart-toolbar-text {
  font-size: 9px;
  color: var(--text3);
}

/* ─── STATUS BAR ──────────────────────────── */
.status-bar {
  background: var(--surface);
  padding: 5px 14px;
  border-top: 1px solid var(--surface2);
}
.status-text {
  font-size: 11px;
  color: var(--text2);
}

/* ─── GUIDE OVERLAY ───────────────────────── */
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.guide-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Lighter dim — keep app visible */
.guide-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(2px);
  transition: background .3s;
}

/* Spotlight cutout — softer shadow */
.guide-spotlight {
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.25), 0 0 24px rgba(137,180,250,.15);
  transition: all .35s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
  z-index: 1;
}

/* Tooltip */
.guide-tooltip {
  position: fixed;
  z-index: 1001;
  background: var(--bg2);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  transition: all .35s cubic-bezier(.22,1,.36,1);
}
.guide-tooltip.mini {
  max-width: 320px;
  padding: 18px 22px;
}

.guide-step-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.guide-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.3;
}

.guide-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text2);
  margin-bottom: 18px;
}
.guide-desc strong {
  color: var(--accent);
}

.guide-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.guide-btn-back {
  background: var(--surface);
  color: var(--text2);
}
.guide-btn-back:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
}
.guide-btn-back:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.guide-btn-next {
  background: var(--accent);
  color: var(--bg);
}
.guide-btn-next:hover {
  background: #9fc5ff;
}
.guide-btn-next.finish {
  background: var(--green);
  color: #000;
}
.guide-btn-next.finish:hover {
  background: #6ee7b7;
}

.guide-dots {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: center;
}
.guide-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface2);
  transition: all .2s;
}
.guide-dot.active {
  background: var(--accent);
  width: 20px;
  border-radius: 4px;
}

.guide-skip {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text3);
  font-size: 14px;
  cursor: pointer;
  transition: color .15s;
  font-family: inherit;
}
.guide-skip:hover { color: var(--text); }

/* ─── FAQ ACCORDION ───────────────────────── */
.faq-wrapper {
  width: 1300px;
  max-width: 100%;
  margin: 24px auto 40px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--surface);
  overflow: hidden;
}

.faq-header {
  background: var(--surface);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  border-bottom: 1px solid var(--surface2);
}
.faq-icon { font-size: 18px; }

.faq-list {
  padding: 4px;
}

.faq-item {
  border-bottom: 1px solid var(--surface);
}
.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  font-family: inherit;
  transition: background .15s;
}
.faq-question:hover {
  background: var(--surface);
}
.faq-question.open {
  background: var(--surface);
}

.faq-arrow {
  font-size: 12px;
  color: var(--text3);
  transition: transform .2s;
  flex-shrink: 0;
}
.faq-question.open .faq-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  padding: 0 16px;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
}
.faq-answer.open {
  max-height: 600px;
  padding: 0 16px 16px;
}

.faq-answer p {
  margin-bottom: 8px;
}
.faq-answer ul, .faq-answer ol {
  margin: 4px 0 8px 20px;
}
.faq-answer li {
  margin-bottom: 3px;
}
.faq-answer code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--yellow);
}
.faq-answer strong {
  color: var(--text);
}

.faq-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 12px;
}
.faq-table th {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--surface2);
}
.faq-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--surface);
  vertical-align: top;
}
.faq-table tr:last-child td {
  border-bottom: none;
}
.faq-table td:first-child {
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
}

/* ─── SCROLLBAR ───────────────────────────── */
.log-area::-webkit-scrollbar {
  width: 5px;
}
.log-area::-webkit-scrollbar-track {
  background: var(--bg3);
}
.log-area::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border-radius: 3px;
}

/* ─── RESPONSIVE ──────────────────────────── */
@media (max-width: 960px) {
  .app-body {
    flex-direction: column;
  }
  .left-panel {
    width: 100%;
    min-width: unset;
  }
}
