/**
 * ═══════════════════════════════════════════════════════════════════
 *  eKYC — SHARED DESIGN SYSTEM
 * ═══════════════════════════════════════════════════════════════════
 *
 *  This stylesheet defines the shared design tokens, base styles,
 *  and reusable components used across ALL eKYC pages.
 *
 *  THEME: "Forest Wellness" — bright natural greens, Figtree typeface.
 *  ("Metsakuur" means "forest cure" in Estonian.)
 *
 *  FOR DEVELOPERS — RE-THEMING:
 *    To re-theme the entire UI, override the CSS custom properties
 *    in the :root block below. All components reference these tokens,
 *    so changing them here propagates everywhere.
 *
 *  STRUCTURE:
 *    1. Design tokens (colors, spacing, typography, shadows)
 *    2. Base / reset styles
 *    3. Header component
 *    4. Phase tag (step indicator)
 *    5. Card / Panel containers
 *    6. Button variants (primary, secondary, ghost)
 *    7. Badge component (success / fail)
 *    8. Data grid (dt/dd key-value pairs)
 *    9. Spinner animation
 *   10. Scrollbar & focus styles
 * ═══════════════════════════════════════════════════════════════════
 */

@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ─── 1. DESIGN TOKENS ───────────────────────────────────────────
   Override these custom properties to re-theme the entire UI.
   ─────────────────────────────────────────────────────────────── */
:root {
  /* Colors — backgrounds */
  --bg: #f0f4ed;                              /* page background */
  --surface: #ffffff;                         /* card / panel background */
  --surface-dim: #e8efe5;                     /* subtle background (inputs, tracks) */
  --surface-raised: #f6f9f4;                  /* slightly elevated surfaces */

  /* Colors — borders */
  --border: #d4dfcf;                          /* default border */
  --border-hover: #b8c9b2;                    /* border on hover */
  --border-active: rgba(22, 163, 74, 0.35);  /* border on focus/active */

  /* Colors — text */
  --text: #1a2e1a;                            /* primary text */
  --text-sub: #3d5a3d;                        /* secondary text */
  --text-muted: #6e8f6e;                      /* muted / hint text */

  /* Colors — accent (brand green) */
  --accent: #16a34a;                          /* primary accent */
  --accent-bright: #22c55e;                   /* hover / highlight state */
  --accent-dim: #15803d;                      /* darker accent variant */
  --accent-glow: rgba(22, 163, 74, 0.08);    /* subtle accent background */

  /* Colors — semantic states */
  --success: #16a34a;
  --success-dim: rgba(22, 163, 74, 0.08);
  --success-border: rgba(22, 163, 74, 0.25);
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.06);
  --danger-border: rgba(220, 38, 38, 0.2);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.07);
  --warn-border: rgba(217, 119, 6, 0.2);

  /* Spacing — border radius scale */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;                       /* pill shape */

  /* Elevation — shadow scale */
  --shadow-xs: 0 1px 2px rgba(26, 46, 26, 0.04);
  --shadow-sm: 0 1px 4px rgba(26, 46, 26, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 46, 26, 0.07);
  --shadow-lg: 0 8px 28px rgba(26, 46, 26, 0.08);
  --shadow-accent: 0 2px 12px rgba(22, 163, 74, 0.2);

  /* Layout */
  --max-w: 420px;                             /* max content width (mobile-first) */

  /* Typography */
  --font: 'Figtree', system-ui, -apple-system, sans-serif;

  /* Animation easings */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);             /* smooth deceleration */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* springy overshoot */
}

/* ─── 2. BASE / RESET ────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 25% -5%, rgba(22, 163, 74, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 105%, rgba(132, 204, 22, 0.04) 0%, transparent 55%);
  color: var(--text);
  padding: 0 16px 40px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0 0 6px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}

h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.92rem; }
p  { margin: 0 0 12px; }

.hidden { display: none !important; }

/* ─── 3. HEADER ──────────────────────────────────────────────── */
/* Branding bar at the top of every page. Replace logos via HTML. */
.page-header {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 8px;
  padding: 20px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.header-logo {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-brand {
  height: 16px;
  width: auto;
  display: block;
  opacity: 0.6;
  flex-shrink: 0;
}

/* ─── 4. PHASE TAG ───────────────────────────────────────────── */
/* Step indicator pill shown at the top of each page.             */
.phase-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 14px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  border: 1px solid rgba(22, 163, 74, 0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
  max-width: var(--max-w);
}

/* ─── 5. CARD / PANEL ────────────────────────────────────────── */
/* Main content containers. Max-width locked to --max-w (420px).  */
.card,
.panel {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.4s var(--ease) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.card h1,
.panel h2 {
  text-align: center;
  margin-bottom: 16px;
}

main {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ─── 6. BUTTONS ─────────────────────────────────────────────── */
/* Three variants: .primary (green CTA), .secondary (outlined),   */
/* .ghost (transparent). Add .primary-full for full-width.        */
.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.005em;
}

.btn:active:not(:disabled),
button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled,
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

button.primary,
.btn.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
}

button.primary:hover:not(:disabled),
.btn.primary:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.25);
}

button.secondary,
.btn.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sub);
}

button.secondary:hover:not(:disabled),
.btn.secondary:hover:not(:disabled) {
  border-color: var(--border-active);
  color: var(--accent);
}

button.primary-full {
  width: 100%;
  margin-bottom: 10px;
}

button.ghost,
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
}

button.ghost:hover:not(:disabled),
.btn.ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── 7. BADGE ───────────────────────────────────────────────── */
/* Status pill: .badge.success (green) or .badge.fail (red).      */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.badge.success {
  background: var(--success-dim);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.badge.fail {
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

/* ─── 8. DATA GRID ───────────────────────────────────────────── */
/* Key-value pairs using <dl>/<dt>/<dd>. Used for result display. */
.data-grid,
.result-grid,
.pp-result-dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(80px, 36%) 1fr;
  gap: 6px 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.data-grid dt,
.result-grid dt,
.pp-result-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.data-grid dd,
.result-grid dd,
.pp-result-dl dd {
  margin: 0;
  word-break: break-word;
  font-size: 0.84rem;
  color: var(--text);
  font-weight: 500;
}

/* ─── 9. SPINNER ─────────────────────────────────────────────── */
/* Reusable loading spinner. Uses --accent color for the arc.     */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(22, 163, 74, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ekyc-spin 0.65s linear infinite;
}

@keyframes ekyc-spin {
  to { transform: rotate(360deg); }
}

/* ─── 10. SCROLLBAR, SELECTION & FOCUS ────────────────────────── */
/* Thin scrollbar, accent selection highlight, visible focus ring. */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

::selection {
  background: rgba(22, 163, 74, 0.15);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 3px;
}
