/* ==========================================
   GLASS POPUPS: sign in / create account / the Simulation, and the setup steps
   Frosted glass over the page, in the same "paper" language as Foresight and
   account details: thin pencil lines, uppercase micro-labels, blue for action.
   Markup: views/includes/auth-modal.ejs + onboarding-modal.ejs
   ========================================== */
:root {
  --fc-blue: 59, 130, 246;
  --fc-glass: rgba(255, 255, 255, 0.74);
  --fc-glass-edge: rgba(255, 255, 255, 0.75);
  --fc-line: rgba(0, 0, 0, 0.1);
  --fc-ink: #111;
  --fc-muted: #888;
  --fc-field: rgba(255, 255, 255, 0.7);
  --fc-chip: #fff;
}
body.dark-mode {
  --fc-blue: 96, 165, 250;
  --fc-glass: rgba(18, 18, 18, 0.74);
  --fc-glass-edge: rgba(255, 255, 255, 0.09);
  --fc-line: rgba(255, 255, 255, 0.12);
  --fc-ink: #eee;
  --fc-muted: #999;
  --fc-field: rgba(255, 255, 255, 0.05);
  --fc-chip: rgba(255, 255, 255, 0.1);
}

body.fc-modal-lock {
  overflow: hidden;
}

/* --- Overlay: the page stays visible, softly blurred --- */
.fc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500; /* above the nav, settings modal and toast */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s;
}
.fc-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* --- The card: frosted glass --- */
.fc-glass-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px 28px 24px;
  background: var(--fc-glass);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--fc-glass-edge);
  border-radius: 20px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  color: var(--fc-ink);
  font-family: 'Inter', sans-serif;
  text-align: left;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.fc-modal-overlay.open .fc-glass-card {
  transform: none;
}

.fc-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--fc-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
}
.fc-modal-close:hover {
  color: var(--fc-ink);
}

/* --- Type --- */
.fc-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fc-muted);
  margin-bottom: 18px;
}
.fc-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--fc-ink);
}
.fc-subtitle {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--fc-muted);
}

/* --- Sign in | Create account (segmented, like the account-detail toggles) --- */
.fc-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
}
.fc-tabs[hidden] {
  display: none;
}
.fc-tab {
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fc-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}
.fc-tab.active {
  background: var(--fc-chip);
  color: var(--fc-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* --- Fields --- */
.fc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fc-field span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fc-muted);
}
.fc-field input {
  padding: 12px 14px;
  border: 1px solid var(--fc-line);
  border-radius: 10px;
  background: var(--fc-field);
  color: var(--fc-ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.fc-field input:focus {
  border-color: rgba(var(--fc-blue), 0.6);
  box-shadow: 0 0 0 4px rgba(var(--fc-blue), 0.12);
}

/* --- Buttons: blue gradient pill (like Foresight's Analyze) + pencil ghost --- */
.fc-btn-primary,
.fc-btn-ghost {
  width: 100%;
  padding: 13px 20px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.fc-btn-primary {
  margin-top: 6px;
  border: none;
  color: #fff;
  background: linear-gradient(
    135deg,
    rgba(var(--fc-blue), 0.95),
    rgba(var(--fc-blue), 0.6)
  );
  box-shadow: 0 4px 20px rgba(var(--fc-blue), 0.25);
}
.fc-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(var(--fc-blue), 0.35);
}
.fc-btn-ghost {
  margin-top: 10px;
  background: none;
  border: 1px dashed var(--fc-line);
  color: var(--fc-muted);
}
.fc-btn-ghost:hover {
  color: var(--fc-ink);
  border-color: var(--fc-muted);
}
.fc-btn-primary:disabled,
.fc-btn-ghost:disabled {
  opacity: 0.6;
  cursor: default;
}
.is-loading {
  animation: fcPulse 1.2s ease-in-out infinite;
}
@keyframes fcPulse {
  50% {
    opacity: 0.55;
  }
}

/* --- Small links --- */
.fc-link-muted {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--fc-muted);
  text-decoration: none;
}
.fc-link-muted:hover {
  color: var(--fc-ink);
}
.fc-switch {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--fc-muted);
}
.fc-switch a {
  color: rgb(var(--fc-blue));
  font-weight: 600;
  text-decoration: none;
}
.fc-fineprint {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fc-muted);
}
.fc-fineprint a {
  color: inherit;
}

/* --- "or" with a pencil line --- */
.fc-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fc-muted);
}
.fc-divider::before,
.fc-divider::after {
  content: '';
  flex: 1;
  border-top: 1px dashed var(--fc-line);
}

/* --- Messages --- */
.fc-message {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}
.fc-message[hidden] {
  display: none;
}
.fc-message--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}
.fc-message--success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #047857;
}
.fc-message--info {
  background: rgba(var(--fc-blue), 0.08);
  border: 1px solid rgba(var(--fc-blue), 0.2);
  color: rgb(var(--fc-blue));
}
body.dark-mode .fc-message--error {
  color: #fca5a5;
}
body.dark-mode .fc-message--success {
  color: #6ee7b7;
}

/* --- The Simulation's module list (pencil-ruled rows) --- */
.fc-module-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  border-top: 1px dashed var(--fc-line);
}
.fc-module-list li {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--fc-line);
  font-size: 13px;
  color: var(--fc-muted);
}
.fc-module-list strong {
  min-width: 78px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 18px;
  color: var(--fc-ink);
}

/* --- Setup steps --- */
.fc-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}
.fc-steps li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--fc-line);
  opacity: 0.55;
}
.fc-steps li.is-done,
.fc-steps li.is-current {
  opacity: 1;
}
.fc-steps li div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fc-steps strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--fc-ink);
}
.fc-steps li div span {
  font-size: 12px;
  color: var(--fc-muted);
}
.fc-step-dot {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--fc-line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--fc-muted);
}
.fc-steps li.is-done .fc-step-dot {
  border-color: transparent;
  background: rgb(var(--fc-blue));
  color: #fff;
}
.fc-steps li.is-current .fc-step-dot {
  border-color: rgb(var(--fc-blue));
  color: rgb(var(--fc-blue));
  box-shadow: 0 0 10px rgba(var(--fc-blue), 0.25);
}

/* Phones: a bottom sheet that feels native */
@media (max-width: 520px) {
  .fc-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .fc-glass-card {
    max-width: none;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    padding: 28px 22px calc(24px + env(safe-area-inset-bottom));
    transform: translateY(40px);
  }
}
