/* Torve Setup Page - premium 2-column workspace layout */

/* ── Page layout ───────────────────────────────────────────────────── */
.setup-page {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding: 0 32px 80px;
}
.setup-layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
  padding-top: 20px;
}

/* ── Left: main content ────────────────────────────────────────────── */
.setup-primary { min-width: 0; }

.setup-page-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.setup-page-intro {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 560px;
}

/* ── Right: sticky summary rail ────────────────────────────────────── */
.setup-rail {
  position: sticky;
  top: 80px;
}
.rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}

/* Progress summary */
.rail-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.rail-progress-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rail-progress-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.rail-progress-bar {
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.rail-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px;
  transition: width .4s;
}

/* Next step */
.rail-next {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.rail-next-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 6px;
}
.rail-next-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.rail-next-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}
.rail-next-btn {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  color: #08080e;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .2s;
}
.rail-next-btn:hover { opacity: .9; }

/* Jump links */
.rail-nav { list-style: none; padding: 0; margin: 0; }
.rail-nav li { margin-bottom: 2px; }
.rail-nav a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.rail-nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.rail-nav a.active { color: var(--accent); background: rgba(200,164,78,.06); }

.rail-help-link {
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.rail-help-link:hover { text-decoration: underline; }

/* ── Section groups ────────────────────────────────────────────────── */
.setup-group {
  margin-bottom: 36px;
  scroll-margin-top: 100px;
}
.setup-group-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.setup-group-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.setup-group-header .setup-group-desc {
  font-size: 13px;
  color: var(--text-muted);
}
.setup-group-header a {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  flex-shrink: 0;
}

/* ── Cards grid ────────────────────────────────────────────────────── */
.setup-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

/* ── Individual card ───────────────────────────────────────────────── */
.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color .2s, box-shadow .2s;
}
.setup-card:hover {
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.setup-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.setup-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.setup-card > p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ── Status badges ─────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-connected { background: rgba(34,197,94,.08); color: #4ade80; border: 1px solid rgba(34,197,94,.12); }
.status-recommended { background: rgba(200,164,78,.08); color: var(--accent); border: 1px solid rgba(200,164,78,.12); }
.status-attention { background: rgba(239,68,68,.08); color: #fca5a5; border: 1px solid rgba(239,68,68,.12); }
.status-default { background: rgba(255,255,255,.03); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Action buttons ────────────────────────────────────────────────── */
.setup-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.btn-sm:disabled { opacity: .4; cursor: not-allowed; }
.btn-setup { background: var(--accent); color: #08080e; }
.btn-setup:hover { opacity: .85; }
.btn-edit { background: rgba(255,255,255,.05); color: var(--text-muted); border: 1px solid var(--border); }
.btn-edit:hover { color: var(--text); border-color: rgba(255,255,255,.15); }
.btn-danger { background: transparent; color: #f87171; border: 1px solid rgba(239,68,68,.12); }
.btn-danger:hover { background: rgba(239,68,68,.04); }

/* ── Info cards ─────────────────────────────────────────────────────── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.info-card h3 { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.info-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.info-card ul { margin: 0 0 8px 16px; }
.info-card li { font-size: 13px; color: var(--text-muted); line-height: 1.5; padding: 1px 0; }
.info-card li strong { color: var(--text); }
.info-card a { color: var(--accent); text-decoration: underline; }

/* ── Sync section compact ──────────────────────────────────────────── */
.sync-accordion {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.sync-accordion-item { border-bottom: 1px solid var(--border); }
.sync-accordion-item:last-child { border-bottom: none; }
.sync-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.sync-accordion-header:hover { background: rgba(255,255,255,.02); }
.sync-accordion-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.sync-accordion-header .sync-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.sync-yes-badge { background: rgba(34,197,94,.08); color: #4ade80; border: 1px solid rgba(34,197,94,.1); }
.sync-no-badge { background: rgba(255,255,255,.03); color: var(--text-muted); border: 1px solid var(--border); }
.sync-partial-badge { background: rgba(200,164,78,.06); color: var(--accent); border: 1px solid rgba(200,164,78,.1); }
.sync-accordion-body {
  display: none;
  padding: 0 20px 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.sync-accordion-item.open .sync-accordion-body { display: block; }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.modal h2 { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.modal .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.modal .note { font-size: 12px; color: #71717a; background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 16px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-actions .btn-sm { flex: 1; text-align: center; padding: 10px; font-size: 13px; }
.modal-alert { margin-bottom: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; display: none; line-height: 1.4; }
.modal-alert.visible { display: block; }
.modal-alert.error { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.12); color: #fca5a5; }
.modal-alert.success { background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.12); color: #86efac; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 300; opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; pointer-events: none; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: #0d1f0d; color: #86efac; border: 1px solid rgba(34,197,94,.2); }
.toast.error { background: #1f0d0d; color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .setup-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .setup-rail {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .setup-rail .rail-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .setup-page { padding: 0 16px 60px; }
  .setup-cards { grid-template-columns: 1fr; }
  .setup-rail { grid-template-columns: 1fr; }
}
