/* M365 Security Assessment — SPA stylesheet */

/* ── Custom properties ─────────────────────────────────────────────────────── */
:root {
  --blue: #0078d4;
  --blue-dark: #005a9e;
  --blue-light: #eff6fc;
  --text: #201f1e;
  --text-muted: #605e5c;
  --text-light: #a19f9d;
  --bg: #f3f2f1;
  --bg-card: #ffffff;
  --border: #edebe9;
  --border-dark: #c8c6c4;
  --green: #107c10;
  --green-bg: #dff6dd;
  --red: #a4262c;
  --red-bg: #fde7e9;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* The [hidden] attribute must win over any display rule an element's classes
   set (e.g. .btn's display: inline-flex) — same specificity, but author CSS
   otherwise beats it on source order alone. Without this, toggling `hidden`
   on a `.btn`-classed <a>/<button> does nothing visible. */
[hidden] {
  display: none !important;
}

body {
  font-family:
    'Segoe UI',
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--blue);
  color: #fff;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.header-logo {
  font-size: 18px;
  opacity: 0.9;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-sub {
  font-size: 12px;
  opacity: 0.75;
  margin-left: 4px;
}

/* ── Main / card ───────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 600px;
  padding: 32px;
}

/* ── Notice banner ─────────────────────────────────────────────────────────── */
.notice-banner {
  background: var(--green-bg);
  color: var(--green);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 14px;
}

/* ── Error banner (backend/network failures) ──────────────────────────────── */
.error-banner {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #f4b8bc;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.error-banner-close {
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

/* ── Step indicator ────────────────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  list-style: none;
  margin-bottom: 32px;
  counter-reset: none;
  position: relative;
}

.step-indicator::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 28px;
  right: 28px;
  height: 2px;
  background: var(--border-dark);
  z-index: 0;
}

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

.si-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.si-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  transition: color 0.2s;
}

/* Active step */
.step-indicator li.active .si-num {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.step-indicator li.active .si-label {
  color: var(--blue);
  font-weight: 600;
}

/* Completed step */
.step-indicator li.done .si-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.step-indicator li.done .si-label {
  color: var(--green);
}
.step-indicator li.done .si-num::after {
  content: '✓';
}
/* hide the number when done */
.step-indicator li.done .si-num {
  font-size: 0;
}
.step-indicator li.done .si-num::after {
  font-size: 13px;
}

/* ── Step panels ───────────────────────────────────────────────────────────── */
.step-panel h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.step-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── Form fields ───────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
}

.req {
  color: var(--red);
}

.field-input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'Segoe UI Mono', 'Cascadia Code', 'Courier New', monospace;
  color: var(--text);
  background: #fff;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

/* A tenant ID filled in from a verified access code is fixed by that code's
   tenant binding (ADR 0006) — render it as locked, not editable. */
.field-input[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

.field-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.field-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.field-error {
  margin-top: 5px;
  font-size: 12px;
  color: var(--red);
}

/* ── Actions ───────────────────────────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  align-items: center;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    opacity 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border-color: var(--border-dark);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
}
.btn-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

/* Anchors styled as buttons (download links) */
a.btn {
  text-decoration: none;
}

.section-subheading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

/* ── FAQ (Step 1) ──────────────────────────────────────────────────────────── */
.faq-group {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.faq-item p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Callout box (e.g. "Buy an access code", Step 3) ──────────────────────── */
.callout-box {
  background: var(--bg);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.callout-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}

.callout-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ── Permission box (Step 2) ───────────────────────────────────────────────── */
.permission-box {
  background: var(--blue-light);
  border: 1px solid #c7e0f4;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.permission-box-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text);
}

.permission-list {
  list-style: disc;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.tenant-badge {
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.tenant-badge code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--text);
}

.consent-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.status-line {
  margin-top: 16px;
  font-size: 13px;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Spinner dot — only for waits genuinely long enough to need one (e.g. the
   consent popup). Most status lines (email OTP send/confirm) resolve in well
   under a second and don't need a loading indicator at all. */
.status-line-waiting::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--blue);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ── Tier cards (Step 3) ───────────────────────────────────────────────────── */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.tier-card {
  border: 2px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  position: relative;
}

.tier-card:hover {
  border-color: var(--blue);
}

.tier-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.tier-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Disabled tier (e.g. Enterprise, pending launch) */
.tier-card-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.tier-card-disabled:hover {
  border-color: var(--border-dark);
}

/* Enterprise sits below Free/Full report as its own full-width row instead of
   squeezing three columns into the card's width. */
.tier-card-wide {
  grid-column: 1 / -1;
}

.tier-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted, #7f8c8d);
}
.tier-note-soon {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted, #7f8c8d);
  text-align: center;
}

.tier-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--border-dark);
  color: var(--text-muted);
  margin-bottom: 10px;
}

.tier-badge-paid {
  background: var(--blue);
  color: #fff;
}

.tier-badge-enterprise {
  background: var(--text-muted);
  color: #fff;
}

.tier-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.tier-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 10px;
}

.tier-features {
  list-style: none;
  padding: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.tier-features li {
  padding: 3px 0;
  padding-left: 16px;
  position: relative;
}

.tier-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-size: 11px;
  top: 4px;
}

/* ── Progress track (Step 4) ───────────────────────────────────────────────── */
.progress-track {
  display: flex;
  align-items: center;
  margin: 24px 0 16px;
}

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

.progress-connector {
  flex: 1;
  height: 2px;
  background: var(--border-dark);
  margin: 0 4px;
  margin-bottom: 18px;
  transition: background 0.3s;
}

.prog-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  background: var(--bg-card);
  transition:
    background 0.3s,
    border-color 0.3s;
}

.prog-text {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
}

/* States */
.prog-active .prog-dot {
  border-color: var(--blue);
  background: var(--blue);
  animation: pulse 1.2s ease-in-out infinite;
}
.prog-active .prog-text {
  color: var(--blue);
  font-weight: 600;
}

.prog-done .prog-dot {
  border-color: var(--green);
  background: var(--green);
}
.prog-done .prog-text {
  color: var(--green);
}

.progress-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  min-height: 20px;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: flex;
  justify-content: center;
  padding: 16px 0 8px;
}

.spinner-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-dark);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Result views ──────────────────────────────────────────────────────────── */
.result-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 20px;
}

.result-icon-success {
  background: var(--green-bg);
  color: var(--green);
}
.result-icon-fail {
  background: var(--red-bg);
  color: var(--red);
}

/* ── Password block ────────────────────────────────────────────────────────── */
.password-block {
  background: #fff8e6;
  border: 1px solid #f0c430;
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0;
}

.password-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.password-note {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.password-value {
  background: #fff;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 16px;
  font-family: 'Segoe UI Mono', 'Cascadia Code', 'Courier New', monospace;
  letter-spacing: 0.08em;
  color: var(--text);
  flex: 1;
  word-break: break-all;
}

/* ── Error detail ──────────────────────────────────────────────────────────── */
.error-detail {
  background: var(--red-bg);
  border: 1px solid #f4b8bc;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--red);
  margin: 12px 0 20px;
  line-height: 1.5;
}

.result-actions {
  margin-top: 24px;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}

.footer-link {
  color: var(--blue);
  text-decoration: none;
}
.footer-link:hover {
  text-decoration: underline;
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(0, 120, 212, 0);
  }
}

/* ── Purchase dialog ───────────────────────────────────────────────────────── */
.modal {
  /* The global reset zeroes every margin, which also kills the `margin: auto`
     a <dialog> relies on to centre itself — put it back explicitly. */
  margin: auto;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-card);
  color: var(--text);
  padding: 24px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-title {
  font-size: 18px;
  margin-bottom: 6px;
}

.buy-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 20px;
}

/* Same affordance as the step-3 tier cards — these are a choice of what to buy,
   not of what to scan, so they get their own class rather than sharing one. */
.buy-option {
  border: 2px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.buy-option:hover {
  border-color: var(--blue);
}

.buy-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.buy-option:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: 20px 16px;
  }

  .tier-grid,
  .buy-option-grid {
    grid-template-columns: 1fr;
  }

  .step-indicator::before {
    display: none;
  }
  .si-label {
    display: none;
  }
}
