/* ============================================================
   Neurolist Web Onboarding — Styles
   Mirrored from Flutter: themeobjects.dart
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --color-primary: #089A8D;
  --color-secondary: #00413B;
  --color-background: #ECF4F3;
  --color-primary-container: #CFE6E4;
  --color-surface: #FFFFFF;
  --color-on-primary: #FFFFFF;
  --color-on-secondary: #FFFFFF;
  --color-on-surface: #000000;
  --color-on-background: #000000;
  --color-error: #B00020;
  --color-on-error: #FFFFFF;
  --color-disabled: #B1B1B1;
  --color-body: rgb(114, 114, 114);
  --color-body-medium: rgb(122, 122, 122);
  --color-label-medium: #088D81;
  --color-subheading: #717171;
  --color-border: rgba(0, 0, 0, 0.05);

  --font-body: 'Space Grotesk', sans-serif;
  --font-heading: 'Satoshi', sans-serif;
  --font-headline: 'Nunito', sans-serif;
  --font-mono: 'PT Mono', monospace;

  --radius-card: 5px;
  --radius-button: 100px;
  --radius-large: 10px;
  --radius-toggle: 20px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Font Faces --- */
@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'Satoshi';
  src: url('/fonts/Satoshi-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: 'Nunito';
  src: url('/fonts/Nunito-Variable.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

@font-face {
  font-family: 'PT Mono';
  src: url('/fonts/PTMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-background);
  color: var(--color-on-surface);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* --- App Shell --- */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Progress Bar Area --- */
#progress-area {
  position: relative;
  padding: 40px 20px 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

#progress-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

#back-button {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#back-button.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-button svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-on-surface);
  stroke-width: 2;
  fill: none;
}

#progress-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-toggle);
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-toggle);
  transition: width 0.4s ease;
  width: 0%;
}

/* Spacer to match the back button width */
#progress-spacer {
  width: 32px;
  height: 10px;
  flex-shrink: 0;
}

/* --- Screen Container --- */
#screen-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  opacity: 1;
}

.screen-content {
  flex: 1;
  padding: 20px 20px 180px 20px;
}

/* --- Footer (fixed bottom button) --- */
#screen-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 20px calc(20px + var(--safe-bottom)) 20px;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(to top, var(--color-background) 60%, transparent);
  padding-top: 40px;
}

#screen-footer:empty {
  background: none;
  padding: 0;
}

#screen-footer > * {
  pointer-events: auto;
}

/* --- Typography --- */
.text-heading {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 24px;
  color: var(--color-on-surface);
  line-height: 1.2;
}

.text-heading-large {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 28px;
  color: var(--color-on-surface);
  line-height: 1.2;
}

.text-heading-results {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 25px;
  color: var(--color-on-surface);
  line-height: 1.2;
}

.text-subtext {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  color: var(--color-primary);
  line-height: 1.4;
}

.text-body {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  color: var(--color-body);
  line-height: 1.4;
}

.text-body-large {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 17px;
  color: rgba(0, 0, 0, 0.9);
  line-height: 1.4;
}

/* --- Buttons --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 60px;
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 18px;
  color: var(--color-on-primary);
  background: var(--color-primary);
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(8, 154, 141, 0.3);
  will-change: transform;
  transform: translateZ(0);
}

.btn:active {
  transform: scale(0.96);
}

.btn.disabled {
  background: var(--color-disabled);
  box-shadow: none;
  cursor: default;
}

.btn.disabled:active {
  transform: none;
}

.btn-error {
  background: var(--color-error);
  box-shadow: 0 4px 12px rgba(176, 0, 32, 0.3);
}

/* Identity screen dual buttons */
.identity-buttons {
  display: flex;
  gap: 16px;
}

.identity-buttons .btn {
  flex: 1;
}

/* --- Option Cards (Quiz) --- */
.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.option-card:active {
  transform: scale(0.98);
  will-change: transform;
}

.option-card.selected {
  background: var(--color-primary);
}

.option-card .option-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.option-card .option-icon circle {
  transition: all 0.2s ease;
}

.option-card .option-text {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--color-on-surface);
  line-height: 1.3;
}

.option-card.selected .option-text {
  color: var(--color-on-primary);
}

/* --- Identity Statement Card --- */
.statement-card {
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

.statement-card-inner {
  padding: 24px;
}

.statement-text {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 25px;
  color: rgba(0, 0, 0, 0.8);
  line-height: 1.3;
}

/* --- Welcome / Interactive Text --- */
.welcome-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: var(--color-background);
}

.welcome-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 110px 40px 120px 40px;
  gap: 15px;
}

.welcome-text-item {
  opacity: 0;
  transition: opacity 500ms ease;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(24px, 6vw, 42px);
  color: var(--color-secondary);
  line-height: 1.15;
  white-space: pre-line;
}

.welcome-text-item.visible {
  opacity: 1;
}

.welcome-text-item.dimmed {
  opacity: 0.3;
}

.welcome-tap-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding-bottom: calc(30px + var(--safe-bottom));
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 21px;
  color: rgba(8, 154, 141, 0.7);
  pointer-events: none;
}

.welcome-glow {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 70px;
  border-radius: 100px 100px 0 0;
  box-shadow: 0 0 60px 10px rgba(8, 154, 141, 0.2);
  pointer-events: none;
}

/* --- Results Screens --- */
.results-illustration {
  width: 100%;
  height: 230px;
  border-radius: var(--radius-card);
  display: flex;
  overflow: hidden;
}

.results-illustration-bad {
  background: var(--color-primary);
  gap: 5px;
}

.results-illustration-bad .illust-half {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
  font-size: 64px;
}

.results-illustration-bad .illust-half:first-child {
  background: rgb(101, 101, 101);
}

.results-illustration-bad .illust-half:last-child {
  background: rgba(8, 154, 141, 0.7);
}

.results-illustration-bad .illust-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--color-on-surface);
}

.results-illustration-positive {
  height: 250px;
  border-radius: var(--radius-large);
  background: var(--color-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 100px;
}

.results-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-card);
}

.results-list-item .item-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.results-list-item .item-text {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 17px;
  color: rgba(0, 0, 0, 0.9);
  line-height: 1.3;
}

/* --- Loading Screen --- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-size: 400% 400%;
  animation: gradient-shift 6s ease infinite alternate;
}

@keyframes gradient-shift {
  0%   { background-position: 0% 0%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

.loading-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-button);
  overflow: hidden;
}

.loading-progress-fill {
  height: 100%;
  background: var(--color-on-primary);
  border-radius: var(--radius-button);
  width: 0%;
  transition: width 12s linear;
}

.loading-title {
  margin-top: 15px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 21px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.loading-fact-container {
  margin-top: 30px;
  width: 100%;
  height: 400px;
  border-radius: var(--radius-card);
  background: rgba(0, 65, 59, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.loading-fact {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(28px, 8vw, 48px);
  color: var(--color-on-secondary);
  text-align: center;
  line-height: 1.2;
  position: absolute;
  padding: 20px;
  transition: opacity 0.5s ease;
}

.loading-fact.hidden {
  opacity: 0;
}

/* --- View Transitions --- */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Start Screen --- */
.btn-secondary {
  background: var(--color-secondary);
  box-shadow: 0 4px 12px rgba(0, 65, 59, 0.3);
}

.start-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 20px;
}

.start-demo {
  text-align: center;
}

.start-task-name {
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.6);
  min-height: 30px;
  padding: 8px 0;
}

.start-arrow {
  font-size: 40px;
  color: var(--color-on-surface);
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

.start-steps {
  text-align: left;
}

.start-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.start-step-emoji {
  font-size: 20px;
  flex-shrink: 0;
}

.start-step-text {
  flex: 1;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: rgba(0, 0, 0, 0.85);
}

.start-step-time {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--color-body-medium);
  flex-shrink: 0;
}

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

.start-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.start-legal {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
  line-height: 1.4;
}

.start-legal a {
  color: var(--color-on-surface);
  text-decoration: none;
}

/* --- Sign-In Screen --- */
.signin-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 80px !important;
}

.signin-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.signin-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 56px;
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.2s ease;
  will-change: transform;
  transform: translateZ(0);
}

.signin-btn:active {
  transform: scale(0.96);
}

.signin-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.signin-btn:disabled:active {
  transform: none;
}

.signin-btn-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.signin-btn-google {
  background: #FFFFFF;
  color: #3c4043;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.signin-btn-apple {
  background: #000000;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.signin-skip {
  display: block;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--color-body-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 16px;
  text-align: center;
}

.signin-skip:active {
  opacity: 0.6;
}

/* --- Utility --- */
.gap-16 { margin-top: 16px; }
.gap-20 { margin-top: 20px; }
.gap-25 { margin-top: 25px; }
.gap-30 { margin-top: 30px; }
