/* Editor connect — Cursor-inspired professional layout */
.editor-page {
  --es-card-w: 520px;
  --es-glow: rgba(108, 140, 255, 0.12);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -30%, rgba(108, 140, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(139, 92, 246, 0.08), transparent 50%),
    var(--bg);
  position: relative;
  overflow: hidden;
}

.editor-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 20%, transparent 75%);
  pointer-events: none;
}

.editor-shell {
  width: 100%;
  max-width: var(--es-card-w);
  position: relative;
  z-index: 1;
}

.editor-card {
  background: rgba(26, 29, 39, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow:
    0 0 0 1px rgba(108, 140, 255, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 80px var(--es-glow);
}

.editor-header {
  text-align: center;
  margin-bottom: 28px;
}

.editor-header .brand-lockup {
  justify-content: center;
  margin-bottom: 16px;
}

.editor-header .auth-logo {
  height: 40px;
  margin-bottom: 12px;
}

.editor-header h1 {
  font-size: 1.625rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  line-height: 1.2;
}

.editor-header .lead {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 400px;
  margin: 0 auto;
}

/* Editor targets */
.editor-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 28px;
}

.editor-target {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.5);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.editor-target svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.editor-target .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.editor-target .name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.editor-target .desc {
  font-size: 0.6875rem;
  color: var(--muted);
}

.editor-target.highlight {
  border-color: rgba(108, 140, 255, 0.45);
  background: rgba(108, 140, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(108, 140, 255, 0.12);
}

/* Stepper */
.es-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 8px 28px;
  position: relative;
}

.es-stepper::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.es-stepper-track {
  position: absolute;
  top: 15px;
  left: 12%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  z-index: 0;
  width: 0%;
  transition: width 0.4s ease;
}

.es-stepper[data-progress="connect"] .es-stepper-track { width: 38%; }
.es-stepper[data-progress="done"] .es-stepper-track { width: 76%; }

.es-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.es-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.25s ease;
}

.es-step.active .es-step-dot {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 140, 255, 0.18);
}

.es-step.done .es-step-dot {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 0;
}

.es-step.done .es-step-dot::after {
  content: '✓';
  font-size: 0.875rem;
  font-weight: 700;
}

.es-step-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.es-step.active .es-step-label,
.es-step.done .es-step-label {
  color: var(--text);
}

/* Panels */
.es-panel {
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.55);
  text-align: center;
}

.es-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.es-panel p:last-child { margin-bottom: 0; }

.es-panel .btn-primary-es {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 220px;
  padding: 13px 28px;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  box-shadow: 0 4px 20px rgba(108, 140, 255, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.es-panel .btn-primary-es:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(108, 140, 255, 0.45);
}

.es-panel .btn-primary-es:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin-bottom: 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.session-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.es-success-ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  border: 2px solid rgba(34, 197, 94, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--success);
  animation: es-pop 0.4s ease;
}

@keyframes es-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.es-panel .title-strong {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.es-key-reveal {
  margin: 16px 0 0;
  padding: 14px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.es-key-warn {
  margin: 0 0 10px !important;
  font-size: 0.8125rem !important;
  color: #fcd34d !important;
  line-height: 1.45 !important;
}

.es-api-key-value {
  display: block;
  word-break: break-all;
  font-size: 0.8125rem;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Features strip */
.es-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.es-feat {
  text-align: center;
  padding: 10px 6px;
}

.es-feat .icon {
  font-size: 1.125rem;
  margin-bottom: 6px;
  opacity: 0.9;
}

.es-feat .label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.es-feat .hint {
  font-size: 0.625rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Connector details */
.es-connector {
  margin-top: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.4);
  overflow: hidden;
}

.es-connector summary {
  padding: 12px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.es-connector summary::-webkit-details-marker { display: none; }

.es-connector summary::after {
  content: '▼';
  font-size: 0.65rem;
  transition: transform 0.2s;
}

.es-connector[open] summary::after { transform: rotate(180deg); }

.es-connector[open] summary { color: var(--text); }

.es-connector-body {
  padding: 0 16px 14px;
  font-size: 0.75rem;
}

.es-kv {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 6px 12px;
  margin-bottom: 4px;
}

.es-kv dt {
  color: var(--muted);
  margin: 0;
}

.es-kv dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.es-kv code {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--surface2);
  border-radius: 4px;
  color: var(--accent);
}

/* Footer actions */
.es-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.es-footer .es-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.es-footer .es-link-btn:hover {
  border-color: rgba(108, 140, 255, 0.4);
  background: rgba(108, 140, 255, 0.08);
  text-decoration: none;
}

.es-footer .es-link-btn.primary-foot {
  background: rgba(108, 140, 255, 0.12);
  border-color: rgba(108, 140, 255, 0.3);
  color: var(--accent);
}

/* Trouble block */
.es-trouble {
  margin-top: 14px;
  text-align: left;
}

.es-trouble summary {
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 0;
}

.es-trouble ol {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.es-trouble li { margin-bottom: 6px; }

.es-trouble code {
  font-size: 0.75rem;
  padding: 2px 6px;
  background: var(--surface2);
  border-radius: 4px;
  color: var(--text);
}

.es-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: es-spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes es-spin { to { transform: rotate(360deg); } }

.editor-page .alert {
  margin-bottom: 16px;
  text-align: left;
  border-radius: 10px;
}

@media (max-width: 540px) {
  .editor-card { padding: 28px 20px 22px; }
  .editor-targets { grid-template-columns: 1fr; }
  .es-features { grid-template-columns: 1fr; }
}
