/*
 * Self-contained styles for the /install setup wizard + its related screens
 * (already-installed, env-write-failed). No CDN / external fonts — this file
 * is the only stylesheet those pages load. Kept separate from public/css/app.css
 * (the authenticated-app stylesheet) so the installer never depends on the
 * app shell.
 */
:root {
  --i-bg-start: #14161f;
  --i-bg-end: #1f2937;
  --i-surface: #ffffff;
  --i-border: #e2e5ea;
  --i-text: #1f2430;
  --i-text-muted: #6b7280;
  --i-accent: #2563eb;
  --i-accent-dark: #1d4ed8;
  --i-success-bg: #ecfdf3;
  --i-success-text: #087443;
  --i-error-bg: #fef2f2;
  --i-error-text: #b91c1c;
  --i-warn-bg: #fffbeb;
  --i-warn-text: #92400e;
  --i-radius: 10px;
}

* { box-sizing: border-box; }

.installer-body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--i-text);
  background: linear-gradient(160deg, var(--i-bg-start), var(--i-bg-end));
}

.installer-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.installer-card {
  position: relative;
  background: var(--i-surface);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  width: 100%;
  max-width: 720px;
  padding: 36px 40px 40px;
}

@media (max-width: 640px) {
  .installer-card { padding: 26px 20px 28px; border-radius: 12px; }
}

.installer-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.installer-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--i-accent), #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.installer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--i-text);
}

.installer-tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--i-text-muted);
}

.installer-footnote {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  text-align: center;
  max-width: 720px;
}

/* ---------------------------------------------------------------------- */
/* Step progress indicator                                                 */
/* ---------------------------------------------------------------------- */

.step-dots {
  display: none; /* revealed once JS confirms stepping actually works */
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 28px;
  list-style: none;
  padding: 0;
}
.js-enabled .step-dots { display: flex; }

.step-dot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  text-decoration: none;
  color: var(--i-text-muted);
}
.step-dot:hover { text-decoration: none; }

.step-dot::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--i-border);
  z-index: 0;
}
.step-dot:first-child::before { display: none; }

.step-dot .dot-num {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--i-surface);
  border: 2px solid var(--i-border);
  color: var(--i-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.step-dot .dot-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.step-dot.is-active .dot-num { border-color: var(--i-accent); color: var(--i-accent); background: #eff4ff; }
.step-dot.is-active .dot-label { color: var(--i-text); }
.step-dot.is-complete .dot-num { border-color: var(--i-accent); background: var(--i-accent); color: #fff; }
.step-dot.is-complete::before { background: var(--i-accent); }

@media (max-width: 560px) {
  .step-dot .dot-label { display: none; }
  .step-dot .dot-num { width: 24px; height: 24px; }
}

/* ---------------------------------------------------------------------- */
/* Step panels                                                             */
/* ---------------------------------------------------------------------- */

.step-panel + .step-panel { margin-top: 28px; padding-top: 24px; border-top: 1px dashed var(--i-border); }
.js-enabled .step-panel { display: none; }
.js-enabled .step-panel.is-active { display: block; }
.js-enabled .step-panel + .step-panel { margin-top: 0; padding-top: 0; border-top: none; }

.step-heading { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.step-subhead { margin: 0 0 20px; color: var(--i-text-muted); font-size: 13px; }

/* ---------------------------------------------------------------------- */
/* Welcome step                                                            */
/* ---------------------------------------------------------------------- */

.welcome-hero { text-align: center; padding: 12px 0 6px; }
.welcome-hero .welcome-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: #eff4ff; color: var(--i-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 18px;
}
.welcome-hero h2 { font-size: 20px; margin: 0 0 8px; }
.welcome-hero p { color: var(--i-text-muted); max-width: 460px; margin: 0 auto 24px; }

/* ---------------------------------------------------------------------- */
/* Forms (shared across steps)                                             */
/* ---------------------------------------------------------------------- */

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-grid .field-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--i-text-muted); }
.field .hint { font-size: 11.5px; color: var(--i-text-muted); margin-top: 4px; }
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field input[type=url] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--i-border);
  border-radius: 7px;
  font-size: 13.5px;
  background: #fff;
  color: var(--i-text);
  font-family: inherit;
}
.field input:focus {
  outline: none;
  border-color: var(--i-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field input:invalid:not(:placeholder-shown) { border-color: #f0ad9c; }

.section-divider { margin: 22px 0 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--i-text-muted); }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--i-border);
  background: #fff;
  color: var(--i-text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: #f4f5f7; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--i-accent); border-color: var(--i-accent); color: #fff; }
.btn-primary:hover { background: var(--i-accent-dark); }
.btn-primary:disabled { background: var(--i-accent); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 14.5px; }

.step-nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}
.js-enabled .step-nav { display: flex; }
.step-nav .spacer { flex: 1; }

/* ---------------------------------------------------------------------- */
/* Requirements table                                                      */
/* ---------------------------------------------------------------------- */

.req-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.req-table th, .req-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--i-border); }
.req-table th { color: var(--i-text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; border-radius: 4px; padding: 2px 9px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge-pass { background: var(--i-success-bg); color: var(--i-success-text); }
.badge-fail { background: var(--i-error-bg); color: var(--i-error-text); }

/* ---------------------------------------------------------------------- */
/* Alerts / inline status                                                  */
/* ---------------------------------------------------------------------- */

.alert { border-radius: var(--i-radius); padding: 12px 16px; margin-bottom: 18px; font-size: 13px; }
.alert-success { background: var(--i-success-bg); color: var(--i-success-text); }
.alert-error { background: var(--i-error-bg); color: var(--i-error-text); }
.alert-warn { background: var(--i-warn-bg); color: var(--i-warn-text); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

.db-test-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.db-test-result { font-size: 13px; font-weight: 600; display: none; align-items: center; gap: 6px; }
.db-test-result.is-visible { display: inline-flex; }
.db-test-result.is-ok { color: var(--i-success-text); }
.db-test-result.is-fail { color: var(--i-error-text); }
.db-test-hint { display: none; margin-top: -6px; margin-bottom: 16px; }
.db-test-hint.is-visible { display: block; }

.pw-strength { font-size: 11.5px; margin-top: 5px; font-weight: 600; }
.pw-strength.pw-weak { color: var(--i-error-text); }
.pw-strength.pw-medium { color: var(--i-warn-text); }
.pw-strength.pw-strong { color: var(--i-success-text); }
.pw-mismatch { font-size: 11.5px; margin-top: 5px; color: var(--i-error-text); font-weight: 600; }

/* ---------------------------------------------------------------------- */
/* Review step                                                             */
/* ---------------------------------------------------------------------- */

.review-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 6px; }
.review-table th, .review-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--i-border); }
.review-table th { width: 40%; color: var(--i-text-muted); font-weight: 600; font-size: 12px; }
.review-group-title { margin: 18px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--i-text-muted); }
.review-group-title:first-child { margin-top: 0; }

/* ---------------------------------------------------------------------- */
/* Installing overlay                                                     */
/* ---------------------------------------------------------------------- */

.installing-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 5;
}
.is-installing .installing-overlay { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--i-border);
  border-top-color: var(--i-accent);
  animation: installer-spin 0.8s linear infinite;
  margin-bottom: 18px;
}
@keyframes installer-spin { to { transform: rotate(360deg); } }

.installing-overlay h3 { margin: 0 0 6px; font-size: 16px; }
.installing-overlay p { margin: 0; color: var(--i-text-muted); font-size: 13px; max-width: 320px; }

/* ---------------------------------------------------------------------- */
/* Success screen (complete.blade.php)                                     */
/* ---------------------------------------------------------------------- */

.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--i-success-bg); color: var(--i-success-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; margin: 0 auto 14px;
}

.card {
  background: #fbfbfd;
  border: 1px solid var(--i-border);
  border-radius: var(--i-radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h3 { margin-top: 0; font-size: 14px; }

.token-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.token-table th, .token-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--i-border); }
.token-table td.token-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }

.mono-line { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; background: #f4f5f7; padding: 8px 10px; border-radius: 6px; margin: 6px 0; }

.checklist { margin: 0; padding-left: 20px; }
.checklist li { margin-bottom: 6px; }

.env-textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  border: 1px solid var(--i-border);
  border-radius: 7px;
  padding: 10px;
  resize: vertical;
}
