/* ==========================================================================
   setup.css — Onboarding & Configuration Page Styles
   Matches Royal Dark Blue & Obsidian Black Design System (theme.css & style.css)
   ========================================================================== */

.setup-main {
  max-width: 1280px;
  padding-top: 7.5rem;
  padding-bottom: 5rem;
}

/* Hero & Readiness Tracker */
.setup-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 1.25rem;
  padding: 1rem 0 3.5rem;
}

.setup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  background: var(--accent-primary-soft);
  border: 1px solid var(--border-highlight);
  color: var(--accent-primary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.setup-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.35rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  max-width: 780px;
}

.setup-progress-card {
  width: 100%;
  margin-top: 1.25rem;
  padding: 1.5rem 1.75rem;
  text-align: left;
  gap: 1.15rem;
  box-shadow: var(--shadow-window);
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.progress-eyebrow {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.progress-title-group strong {
  font-size: 1.125rem;
  color: var(--text-primary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  background: var(--bg-elevated);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-steps-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.progress-pill {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.25s ease, transform 0.2s ease, background 0.25s ease;
}

.progress-pill:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.progress-pill.is-complete {
  border-color: hsla(190, 95%, 52%, 0.45);
  background: linear-gradient(135deg, var(--accent-secondary-soft), var(--bg-elevated));
}

.pill-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  flex: none;
}

.progress-pill.is-complete .pill-num {
  background: var(--accent-secondary);
  color: var(--bg-primary);
  border-color: transparent;
}

.pill-meta {
  display: grid;
  min-width: 0;
}

.pill-meta b {
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-meta small {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-icon {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.progress-pill.is-complete .pill-icon {
  color: var(--accent-secondary);
}

/* Step Sections */
.setup-step {
  padding: 3rem 0;
  border-top: 1px solid var(--border-subtle);
}

.step-header {
  margin-bottom: 2rem;
}

.step-badge-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.step-number-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid var(--border-highlight);
}

.setup-step h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.setup-config-card,
.setup-guide-card {
  gap: 1.25rem;
}

.setup-config-card p,
.setup-guide-card p {
  max-width: none;
}

.card-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.icon-accent {
  color: var(--accent-primary);
  margin-right: 0.4rem;
}

.key-counter-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Gemini Keys List */
.keys-list {
  display: grid;
  gap: 0.85rem;
}

.key-item {
  padding: 1rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  gap: 0.7rem;
  transition: border-color 0.2s ease;
}

.key-item:focus-within {
  border-color: var(--border-highlight);
}

.key-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.key-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.key-role-tag.primary {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid var(--border-highlight);
}

.key-role-tag.fallback {
  background: var(--accent-secondary-soft);
  color: var(--accent-secondary);
}

.key-label-input {
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.15rem 0.45rem;
  width: 170px;
}

.key-label-input:hover,
.key-label-input:focus {
  border-color: var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
}

.key-item-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-highlight);
  background: var(--bg-elevated);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn.danger:hover:not(:disabled) {
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}

/* Inputs & Form Controls */
.field-group {
  display: grid;
  gap: 0.5rem;
}

.field-group.compact {
  gap: 0.4rem;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.field-label small {
  font-weight: 400;
  color: var(--text-secondary);
}

.input-action-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-prefix-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.setup-input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 2.45rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setup-input.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
}

.setup-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.input-wrapper .icon-btn {
  position: absolute;
  right: 0.35rem;
  border: 0;
  background: transparent;
}

.btn-sm {
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}

.btn-solid.btn-sm {
  border-color: transparent;
}

.keys-actions-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rotation-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-primary-soft), transparent);
  border: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

.rotation-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--accent-primary);
  display: grid;
  place-items: center;
  flex: none;
}

.rotation-banner b {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

/* Step 2: Built-In Bot Pairing Box */
.pairing-hero-box {
  padding: 1.25rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  gap: 1.15rem;
}

.pairing-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.pairing-eyebrow {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.pairing-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.pairing-code-pill code {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--accent-secondary);
}

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

.pairing-cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.pairing-cta-grid .btn {
  justify-content: center;
  cursor: pointer;
}

.autodetect-listening {
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  display: grid;
  gap: 0.65rem;
}

.pulse-ring-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent-secondary);
  font-size: 0.875rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-secondary);
  box-shadow: 0 0 0 0 var(--accent-secondary);
  animation: pulse-beacon 1.6s infinite;
}

@keyframes pulse-beacon {
  0% {
    box-shadow: 0 0 0 0 hsla(190, 95%, 52%, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px hsla(190, 95%, 52%, 0);
  }

  100% {
    box-shadow: 0 0 0 0 hsla(190, 95%, 52%, 0);
  }
}

.listening-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.connected-account-pill {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.05rem;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid hsla(190, 95%, 52%, 0.45);
}

.account-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: var(--accent-secondary-soft);
  color: var(--accent-secondary);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.account-details {
  display: grid;
  flex: 1;
}

.account-details b {
  font-size: 0.9rem;
}

.account-details small {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Step 3: NotebookLM Auth Visual & Controls */
.auth-flow-visual {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.auth-stage {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  opacity: 0.55;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.auth-stage.is-current,
.auth-stage.is-done {
  opacity: 1;
}

.stage-circle {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.auth-stage.is-current .stage-circle {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

.auth-stage.is-done .stage-circle {
  border-color: transparent;
  background: var(--accent-secondary);
  color: var(--bg-primary);
}

.auth-stage b {
  font-size: 0.8125rem;
}

.auth-stage small {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.auth-connector {
  width: 2.5rem;
  height: 2px;
  background: var(--border-subtle);
}

.nlm-action-panel {
  padding: 1.25rem;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  gap: 1.1rem;
}

.nlm-status-display {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.nlm-status-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--accent-primary-soft);
  border: 1px solid var(--border-highlight);
  color: var(--accent-primary);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex: none;
}

.nlm-status-icon.ok {
  background: var(--accent-secondary-soft);
  border-color: hsla(190, 95%, 52%, 0.45);
  color: var(--accent-secondary);
}

.nlm-status-copy b {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.nlm-status-copy p {
  font-size: 0.8125rem;
}

.nlm-buttons-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.file-upload-btn {
  cursor: pointer;
}

.advanced-endpoint-details {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
  font-size: 0.8125rem;
}

.advanced-endpoint-details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.advanced-endpoint-details summary::-webkit-details-marker {
  display: none;
}

.advanced-endpoint-details summary:hover {
  color: var(--text-primary);
}

.advanced-endpoint-body {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.85rem;
}

/* Guide Cards (Right Column) */
.guide-header {
  display: grid;
  gap: 0.35rem;
}

.guide-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-secondary);
  background: var(--accent-secondary-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.guide-steps {
  list-style: none;
  display: grid;
  gap: 1rem;
}

.guide-steps li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.guide-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.guide-steps b {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.guide-steps p {
  font-size: 0.8125rem;
}

.inline-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

.inline-link:hover {
  text-decoration: underline;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78em;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-primary-soft);
  border: 1px solid var(--border-highlight);
  color: var(--accent-primary);
  cursor: pointer;
}

.guide-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.guide-tip i {
  color: var(--accent-warning);
  margin-top: 0.15rem;
}

.guide-mini-win {
  width: 100%;
  margin-top: 0.25rem;
}

/* Finish & Payload Inspector */
.setup-footer-section {
  padding-top: 2rem;
}

.setup-finish-card {
  padding: 3rem 2rem;
}

.finish-actions-row {
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-danger-outline:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.payload-inspector {
  width: min(100%, 760px);
  margin-top: 1.25rem;
}

.inspector-tabs {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.tab-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.tab-pill.is-active,
.tab-pill:hover {
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

.payload-code {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Toast Notifications */
.setup-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: grid;
  gap: 0.6rem;
  max-width: 360px;
}

.setup-toast {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-window);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  animation: toast-in 0.25s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .progress-steps-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .setup-progress-card {
    padding: 1.15rem;
  }

  .input-action-row,
  .pairing-cta-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .auth-flow-visual {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .auth-connector {
    display: none;
  }
}

/* Cloud browser live view for the NotebookLM sign-in */
.nlm-live-panel {
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  overflow: hidden;
  background: #0b0d12;
}

.nlm-live-panel iframe {
  display: block;
  width: 100%;
  height: 640px;
  border: 0;
}

@media (max-width: 640px) {
  .nlm-live-panel iframe {
    height: 520px;
  }
}

/* ==========================================================================
   Performance mode (body.perf-lite): this page is mostly form inputs, so the
   costly full-screen effects are replaced with cheap static equivalents.
   ========================================================================== */
.perf-lite::after {
  display: none;
}

/* film grain (feTurbulence over the whole page) */
.perf-lite .bg-fx {
  contain: strict;
}

.perf-lite .bg-strips {
  display: none;
}

/* masked, animated, blurred sweep */
.perf-lite .orb {
  /* 110px blur filter -> plain radial gradient */
  filter: none;
  background: radial-gradient(circle closest-side, var(--orb-primary), transparent) !important;
  opacity: 0.55;
}

.perf-lite .header,
.perf-lite .nav {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.perf-lite .header {
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
}

.perf-lite .btn-solid::before {
  animation: none;
}

/* endless halo animation */
.perf-lite .bento-card::before {
  display: none;
}

/* cursor spotlight layer */
.perf-lite .bento-card {
  box-shadow: none;
}

/* Skip layout/paint for sections that are off-screen */
.perf-lite .setup-step,
.perf-lite .foot {
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

/* .reveal fade-ins use a transform already; keep them on the compositor */
.perf-lite .reveal {
  will-change: opacity, transform;
}

html {
  scroll-behavior: auto;
}