/**
 * app-shell.css — shared iOS mobile shell for TASC Ready Capacitor app
 * Applied to: app.html, app-dashboard.html, app-employer.html, index.html
 */

/* ── iOS safe-area variables ───────────────────────────────────── */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* TASC brand colors (aligned with app.html) */
  --shell-bg: #0c0c10;
  --shell-bg-card: #16161d;
  --shell-bg-elevated: #1e1e28;
  --shell-bg-input: #22222e;
  --shell-border: #2a2a3a;
  --shell-text: #e8e6e3;
  --shell-text-dim: #8a8a97;
  --shell-text-muted: #5a5a6e;
  --shell-accent: #6366f1;
  --shell-accent-soft: rgba(99,102,241,0.12);
  --shell-emerald: #00e676;
  --shell-emerald-soft: rgba(0,230,118,0.12);
  --shell-cyan: #06b6d4;
  --shell-cyan-soft: rgba(6,182,212,0.12);
  --shell-green: #22c55e;
  --shell-green-soft: rgba(34,197,94,0.12);
  --shell-amber: #f59e0b;
  --shell-amber-soft: rgba(245,158,11,0.12);
  --shell-red: #ef4444;
  --shell-red-soft: rgba(239,68,68,0.12);
  --shell-muted-soft: rgba(100,116,139,0.12);
  --shell-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shell-radius: 14px;
  --shell-radius-sm: 10px;
  --shell-radius-xs: 6px;
}

@media (prefers-color-scheme: light) {
  :root {
    --shell-bg: #f8f8f8;
    --shell-bg-card: #ffffff;
    --shell-bg-elevated: #f0f0f2;
    --shell-bg-input: #eeeeef;
    --shell-border: #e0e0e8;
    --shell-text: #1a1a2e;
    --shell-text-dim: #666680;
    --shell-text-muted: #9999b0;
    --shell-accent-soft: rgba(99,102,241,0.10);
    --shell-green-soft: rgba(34,197,94,0.10);
    --shell-emerald-soft: rgba(0,230,118,0.10);
    --shell-cyan-soft: rgba(6,182,212,0.10);
    --shell-amber-soft: rgba(245,158,11,0.10);
    --shell-red-soft: rgba(239,68,68,0.10);
    --shell-muted-soft: rgba(100,116,139,0.10);
  }
}

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

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--shell-bg);
  color: var(--shell-text);
  font-family: var(--shell-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  /* Cap body bottom at safe-area so home-indicator never causes black gap */
  padding-bottom: var(--safe-bottom);
}

/* iOS Capacitor only: ensure the full viewport has no black gaps */
body.is-capacitor.is-ios {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Safe-area-aware full-bleed */
  background-color: var(--shell-bg);
}

/* Ensure root viewport fills notch area gracefully */
#root, .page {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ── Capacitor environment classes (added by app-shell.js) ──────
   body.is-capacitor  — running inside Capacitor WebView
   body.is-browser    — running in a regular browser
   body.is-ios        — iOS device (iPhone/iPad/iPod + WKWebView)
 */

/* Hide PWA install banners inside Capacitor */
body.is-capacitor .pwa-install-banner,
body.is-capacitor [data-install-prompt],
body.is-capacitor .smart-banner,
body.is-capacitor .app-banner,
body.is-capacitor .add-to-home-screen {
  display: none !important;
}

/* Capacitor-specific safe-area adjustments */
body.is-capacitor.is-ios {
  /* iOS status bar safe area */
  --status-bar-height: env(safe-area-inset-top, 0px);
}

/* ── 44px minimum touch targets ───────────────────────────────── */
button,
.btn,
.cta-btn,
.entry-card__cta,
.btn-google,
.btn-apple,
.btn-email,
.auth-back,
[role="button"],
a.btn {
  min-height: 44px;
  min-width: 44px;
}

/* ── Native-feeling press states ──────────────────────────────── */
button:active,
.btn:active,
.cta-btn:active,
.entry-card:active,
.path-card:active,
.entry-card__cta:active,
.btn-google:active,
.btn-apple:active,
.btn-email:active {
  opacity: 0.72;
  transform: scale(0.975);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

/* ── Hover kill-switch for touch devices ─────────────────────── */
@media (hover: none), (hover: on-demand) {
  button:hover,
  .btn:hover,
  .cta-btn:hover,
  .path-card:hover,
  .entry-card:hover {
    /* No hover effects on touch devices — they cause UX confusion */
    opacity: 1;
    transform: none;
  }
}

/* ── Page transitions ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

.page {
  animation: slideUp 0.25s ease forwards;
}

/* ── Cards: consistent spacing + radius ───────────────────────── */
.path-card,
.entry-card,
.card {
  border-radius: var(--shell-radius, 14px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.03);
  border: 1px solid var(--shell-border);
}

.entry-card,
.path-card {
  padding: 22px 20px;
}

/* ── Bottom toast: safe-area aware ─────────────────────────────── */
.toast {
  bottom: calc(var(--safe-bottom) + 24px);
  /* Ensure toast never gets hidden behind home indicator */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
}

/* ── Keyboard-safe form spacing ────────────────────────────────
   Forms scroll into view when focused on iOS */
input:focus,
textarea:focus,
select:focus {
  scroll-margin-top: 120px;
}

/* ── OTP inputs: 48px+ touch targets ─────────────────────────── */
.otp-input,
input[type="text"][maxlength],
input[type="tel"][maxlength] {
  min-height: 52px;
  min-width: 48px;
  font-size: 20px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 8px;
  text-align: center;
}

/* ── Loading / skeleton ──────────────────────────────────────── */
.skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.skeleton-line {
  background: var(--shell-bg-elevated);
  border-radius: var(--shell-radius-sm);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hidden utility ──────────────────────────────────────────── */
.hidden        { display: none !important; }
.sr-only       { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Disabled button state ───────────────────────────────────── */
button:disabled,
.btn:disabled,
.cta-btn:disabled,
[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Haptic-ready attribute (hook for future native haptics) ────
   Add data-haptic="light|medium|heavy" to buttons for iOS haptics */
[data-haptic] {
  cursor: pointer;
}

/* ── Smooth scrolling only for non-capacitor ─────────────────── */
body.is-browser {
  scroll-behavior: smooth;
}

/* Capacitor: rely on native scrolling with overscroll-behavior */
body.is-capacitor {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Auth screen nav: 44px back button ──────────────────────── */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--shell-text-dim);
  font-size: 14px;
  font-family: var(--shell-font);
  cursor: pointer;
  padding: 8px 4px;
  margin-bottom: 20px;
  min-height: 44px;
  min-width: 44px;
  -webkit-tap-highlight-color: transparent;
}
.auth-back:hover { color: var(--shell-text); }

/* ── Card feature list ───────────────────────────────────────── */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--shell-text-dim);
}