/* ============================================
   AGÊNCIA IA INSTALLER — DARK THEME
   ============================================ */

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-elevated: #1c2128;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-subtle: #21262d;

  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);
  --orange-hover: #fb923c;

  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);

  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);

  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.15);

  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);

  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);

  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.4));
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.version-badge {
  background: var(--orange-dim);
  color: var(--orange);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

/* ============================================
   STEP INDICATOR
   ============================================ */

.steps-container {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
  overflow-x: auto;
}

.steps-track {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 600px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 2px solid var(--border);
  transition: all var(--transition);
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color var(--transition);
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 20px;
  transition: background var(--transition);
}

/* Active step */
.step-item.active .step-dot {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.4);
}

.step-item.active .step-label {
  color: var(--orange);
  font-weight: 600;
}

/* Completed step */
.step-item.completed .step-dot {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.step-item.completed .step-label {
  color: var(--green);
}

.step-item.completed + .step-connector {
  background: var(--green);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ============================================
   CARD
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.card-body {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
}

/* ============================================
   STEP PANELS
   ============================================ */

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

/* ============================================
   PLATFORM CARDS
   ============================================ */

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

.platform-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: all var(--transition);
  color: var(--text);
}

.platform-card:hover {
  border-color: var(--orange);
  background: var(--orange-dim);
  transform: translateY(-2px);
}

.platform-card.selected {
  border-color: var(--orange);
  background: var(--orange-dim);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.platform-emoji {
  font-size: 2.5rem;
}

.platform-name {
  font-size: 1rem;
  font-weight: 600;
}

.platform-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   SUB OPTIONS
   ============================================ */

.sub-options {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sub-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio-option {
  cursor: pointer;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.radio-card:hover {
  border-color: var(--orange);
}

.radio-option input:checked + .radio-card {
  border-color: var(--orange);
  background: var(--orange-dim);
}

.radio-icon {
  font-size: 1.4rem;
}

.radio-card strong {
  display: block;
  font-size: 0.9rem;
}

.radio-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   SSH FIELDS
   ============================================ */

.ssh-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  background: var(--bg-elevated);
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin-bottom: 12px;
}

.tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-group-sm {
  max-width: 120px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.required {
  color: var(--orange);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: var(--bg-card);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.field-error {
  font-size: 0.75rem;
  color: var(--red);
  display: none;
}

.field-error.visible {
  display: block;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
  background: var(--orange);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-primary:hover:not(:disabled) {
  background: var(--orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

/* ============================================
   TEST RESULT
   ============================================ */

.test-result {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'SF Mono', monospace;
}

.test-result.success {
  background: var(--green-dim);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.test-result.error {
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}

/* ============================================
   AGENT SECTIONS
   ============================================ */

.agent-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.agent-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-badge-main {
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.agent-badge-support {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ============================================
   MODEL HINTS
   ============================================ */

.model-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.model-hint {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'SF Mono', monospace;
}

.model-hint:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-dim);
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ============================================
   INFO BOX
   ============================================ */

.info-box {
  display: flex;
  gap: 12px;
  background: var(--blue-dim);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.info-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-box strong {
  display: block;
  font-size: 0.85rem;
  color: var(--blue);
  margin-bottom: 4px;
}

.info-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   SECTION TITLE
   ============================================ */

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: -8px;
}

/* ============================================
   REVIEW
   ============================================ */

.review-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.review-section-title {
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--orange);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.review-rows {
  padding: 4px 0;
}

.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.review-row:last-child {
  border-bottom: none;
}

.review-key {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 0 0 40%;
}

.review-value {
  font-size: 0.85rem;
  color: var(--text);
  text-align: right;
  font-family: 'SF Mono', monospace;
  word-break: break-all;
}

.review-value.masked {
  color: var(--text-dim);
  font-family: inherit;
}

/* ============================================
   CONFIRM BOX
   ============================================ */

.confirm-box {
  background: var(--yellow-dim);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--yellow);
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--orange);
  flex-shrink: 0;
}

/* ============================================
   TERMINAL
   ============================================ */

.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #090d13;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.terminal-body {
  padding: 16px;
  height: 360px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.terminal-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line.dim { color: var(--text-dim); }
.terminal-line.info { color: #93c5fd; }
.terminal-line.success { color: var(--green); }
.terminal-line.error { color: var(--red); }
.terminal-line.step { color: var(--orange); font-weight: 600; }
.terminal-line.debug { color: var(--text-dim); }
.terminal-line.separator { color: var(--border); }

/* ============================================
   INSTALL STATUS
   ============================================ */

.install-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ============================================
   SUCCESS / FAIL
   ============================================ */

.success-header {
  text-align: center;
  background: linear-gradient(135deg, var(--bg-card), rgba(34, 197, 94, 0.05));
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(34, 197, 94, 0.4));
}

.result-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.result-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.result-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.result-card strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.result-card a {
  color: var(--orange);
  text-decoration: none;
  font-size: 0.8rem;
  font-family: monospace;
  word-break: break-all;
}

.result-card a:hover {
  text-decoration: underline;
}

.result-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.next-steps {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.next-steps h3 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.next-steps ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.next-steps li {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.next-steps code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--orange);
}

.fail-content {
  text-align: center;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.fail-icon {
  font-size: 3rem;
}

.fail-content h3 {
  font-size: 1.1rem;
}

.fail-message {
  font-size: 0.85rem;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  max-width: 500px;
  word-break: break-word;
  font-family: monospace;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  .platform-grid {
    grid-template-columns: 1fr;
  }

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

  .radio-group {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 20px 16px 60px;
  }

  .card-header, .card-body, .card-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .terminal-body {
    height: 260px;
  }

  .form-group-sm {
    max-width: 100%;
  }
}
