/**
 * InMyEyes / CarEZgo Design System V3
 * File: imy-design-system-v3.css
 *
 * Phase 2 definition only.
 * - Not linked from parking.html or any existing page
 * - Does not override existing selectors / IDs
 * - Does not contain business logic
 * - Do not import until a later domain migration is approved
 *
 * Namespace: --imy3-* tokens, .imy3-* classes
 * Retired v2 misnomer: --imy-purple (was stone/taupe). Use --imy3-stone-*
 */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */

:root,
.imy3-root {
  /* Color — one product language. Orange = brand. Green = success. Blue = info. */
  --imy3-brand: #fa6b1a;
  --imy3-brand-hover: #e85a0c;
  --imy3-brand-pressed: #c94d0a;
  --imy3-brand-tint: #fff1e8;
  --imy3-brand-soft: #ffe8d6;

  --imy3-primary: var(--imy3-brand);
  --imy3-secondary: #4b4b4b;
  --imy3-secondary-tint: #f5f5f5;

  --imy3-success: #16a34a;
  --imy3-success-hover: #15803d;
  --imy3-success-tint: #ecfdf5;
  --imy3-success-ink: #14532d;

  --imy3-warning: #d97706;
  --imy3-warning-hover: #b45309;
  --imy3-warning-tint: #fef3c7;
  --imy3-warning-ink: #7c2d12;

  --imy3-danger: #dc2626;
  --imy3-danger-hover: #b91c1c;
  --imy3-danger-tint: #fee2e2;
  --imy3-danger-ink: #7f1d1d;

  --imy3-info: #0b63ce;
  --imy3-info-hover: #084ea3;
  --imy3-info-tint: #e8f1ff;
  --imy3-info-ink: #0f3f7a;

  --imy3-stone-500: #78716c;
  --imy3-stone-700: #57534e;
  --imy3-stone-100: #f5f5f4;

  --imy3-neutral: #a3a3a3;
  --imy3-neutral-ink: #4b4b4b;
  --imy3-neutral-fill: #f5f5f5;

  --imy3-surface: #fff5e9;
  --imy3-surface-2: #fff9f2;
  --imy3-surface-raised: #ffffff;
  --imy3-surface-map: #e9e4dc;
  --imy3-overlay: rgba(31, 31, 31, 0.4);
  --imy3-border: #e8e0d6;
  --imy3-border-strong: #d4c8ba;

  --imy3-text-primary: #1f1f1f;
  --imy3-text-secondary: #525252;
  --imy3-text-muted: #737373;
  --imy3-text-on-brand: #ffffff;
  --imy3-text-on-success: #ffffff;
  --imy3-text-on-danger: #ffffff;
  --imy3-text-on-info: #ffffff;

  --imy3-focus: #fa6b1a;
  --imy3-focus-ring: 0 0 0 3px rgba(250, 107, 26, 0.35);

  /* Type */
  --imy3-font: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC",
    "Hiragino Sans CNS", "Microsoft JhengHei", "Noto Sans", sans-serif;
  --imy3-font-numeric: ui-monospace, "SF Mono", "Roboto Mono", "Noto Sans Mono",
    Menlo, Consolas, monospace;
  --imy3-fs-display: 1.75rem;
  --imy3-fs-h1: 1.375rem;
  --imy3-fs-h2: 1.25rem;
  --imy3-fs-h3: 1.125rem;
  --imy3-fs-title: 1.125rem;
  --imy3-fs-body: 1rem;
  --imy3-fs-body-sm: 0.875rem;
  --imy3-fs-caption: 0.75rem;
  --imy3-fs-label: 0.8125rem;
  --imy3-fs-button: 1.125rem;
  --imy3-fs-numeric: 0.9375rem;
  --imy3-lh-tight: 1.25;
  --imy3-lh-body: 1.5;
  --imy3-lh-ui: 1.35;
  --imy3-fw-regular: 400;
  --imy3-fw-medium: 600;
  --imy3-fw-bold: 700;
  --imy3-fw-black: 800;

  /* Space */
  --imy3-space-2: 2px;
  --imy3-space-4: 4px;
  --imy3-space-6: 6px;
  --imy3-space-8: 8px;
  --imy3-space-12: 12px;
  --imy3-space-16: 16px;
  --imy3-space-20: 20px;
  --imy3-space-24: 24px;
  --imy3-space-32: 32px;
  --imy3-section-gap: var(--imy3-space-24);
  --imy3-card-pad: var(--imy3-space-16);
  --imy3-dialog-pad: var(--imy3-space-20);
  --imy3-sheet-pad: var(--imy3-space-16);
  --imy3-btn-gap: var(--imy3-space-8);
  --imy3-chip-gap: var(--imy3-space-8);

  /* Radius */
  --imy3-radius-xs: 6px;
  --imy3-radius-sm: 8px;
  --imy3-radius-md: 12px;
  --imy3-radius-lg: 16px;
  --imy3-radius-xl: 24px;
  --imy3-radius-pill: 999px;
  --imy3-radius-sheet: 20px 20px 0 0;

  /* Shadow */
  --imy3-shadow-card: 0 4px 16px rgba(31, 31, 31, 0.06);
  --imy3-shadow-floating: 0 8px 24px rgba(31, 31, 31, 0.12);
  --imy3-shadow-sheet: 0 -8px 28px rgba(31, 31, 31, 0.1);
  --imy3-shadow-modal: 0 16px 48px rgba(31, 31, 31, 0.18);
  --imy3-shadow-map: 0 2px 10px rgba(31, 31, 31, 0.16);
  --imy3-shadow-focus: var(--imy3-focus-ring);

  /* Motion */
  --imy3-dur-fast: 120ms;
  --imy3-dur-normal: 180ms;
  --imy3-dur-slow: 280ms;
  --imy3-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --imy3-ease-emphasized: cubic-bezier(0.2, 0, 0, 1.15);

  /* Control */
  --imy3-touch: 44px;
  --imy3-fab: 52px;
  --imy3-icon: 24px;
  --imy3-icon-sm: 20px;
  --imy3-icon-stroke: 1.75px;
  --imy3-safe-top: env(safe-area-inset-top, 0px);
  --imy3-safe-right: env(safe-area-inset-right, 0px);
  --imy3-safe-bottom: env(safe-area-inset-bottom, 0px);
  --imy3-safe-left: env(safe-area-inset-left, 0px);
  --imy3-z-map: 1;
  --imy3-z-chrome: 40;
  --imy3-z-sheet: 240;
  --imy3-z-modal: 320;
  --imy3-z-toast: 400;
  --imy3-z-coach: 480;
}

/* ==========================================================================
   2. TYPE
   ========================================================================== */

.imy3-display,
.imy3-h1,
.imy3-h2,
.imy3-h3,
.imy3-title,
.imy3-body,
.imy3-body-sm,
.imy3-caption,
.imy3-label,
.imy3-numeric {
  font-family: var(--imy3-font);
  color: var(--imy3-text-primary);
  margin: 0;
}

.imy3-display {
  font-size: var(--imy3-fs-display);
  line-height: var(--imy3-lh-tight);
  font-weight: var(--imy3-fw-black);
}

.imy3-h1 {
  font-size: var(--imy3-fs-h1);
  line-height: var(--imy3-lh-tight);
  font-weight: var(--imy3-fw-black);
}

.imy3-h2 {
  font-size: var(--imy3-fs-h2);
  line-height: var(--imy3-lh-tight);
  font-weight: var(--imy3-fw-bold);
}

.imy3-h3 {
  font-size: var(--imy3-fs-h3);
  line-height: var(--imy3-lh-ui);
  font-weight: var(--imy3-fw-bold);
}

.imy3-title {
  font-size: var(--imy3-fs-title);
  line-height: var(--imy3-lh-ui);
  font-weight: var(--imy3-fw-black);
}

.imy3-body {
  font-size: var(--imy3-fs-body);
  line-height: var(--imy3-lh-body);
  font-weight: var(--imy3-fw-regular);
}

.imy3-body-sm {
  font-size: var(--imy3-fs-body-sm);
  line-height: var(--imy3-lh-body);
  color: var(--imy3-text-secondary);
}

.imy3-caption {
  font-size: var(--imy3-fs-caption);
  line-height: var(--imy3-lh-ui);
  color: var(--imy3-text-muted);
}

.imy3-label {
  font-size: var(--imy3-fs-label);
  line-height: var(--imy3-lh-ui);
  font-weight: var(--imy3-fw-medium);
  color: var(--imy3-text-secondary);
}

.imy3-numeric {
  font-family: var(--imy3-font-numeric);
  font-size: var(--imy3-fs-numeric);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  font-weight: var(--imy3-fw-medium);
}

/* ==========================================================================
   3. BUTTON
   ========================================================================== */

.imy3-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--imy3-space-8);
  min-height: var(--imy3-touch);
  padding: var(--imy3-space-12) var(--imy3-space-16);
  border: 1.5px solid transparent;
  border-radius: var(--imy3-radius-md);
  font-family: var(--imy3-font);
  font-size: var(--imy3-fs-button);
  font-weight: var(--imy3-fw-bold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--imy3-dur-fast) var(--imy3-ease-standard),
    background-color var(--imy3-dur-fast) var(--imy3-ease-standard),
    box-shadow var(--imy3-dur-fast) var(--imy3-ease-standard),
    border-color var(--imy3-dur-fast) var(--imy3-ease-standard);
}

.imy3-btn:focus-visible {
  outline: none;
  box-shadow: var(--imy3-shadow-focus);
}

.imy3-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.imy3-btn--primary {
  background: var(--imy3-primary);
  color: var(--imy3-text-on-brand);
}

.imy3-btn--primary:hover:not(:disabled) {
  background: var(--imy3-brand-hover);
}

.imy3-btn--secondary {
  background: var(--imy3-secondary-tint);
  color: var(--imy3-secondary);
  border-color: var(--imy3-border);
}

.imy3-btn--tertiary {
  background: var(--imy3-brand-tint);
  color: var(--imy3-brand-hover);
}

.imy3-btn--ghost {
  background: transparent;
  color: var(--imy3-text-secondary);
}

.imy3-btn--destructive {
  background: var(--imy3-danger);
  color: var(--imy3-text-on-danger);
}

.imy3-btn--destructive:hover:not(:disabled) {
  background: var(--imy3-danger-hover);
}

.imy3-btn--success {
  background: var(--imy3-success);
  color: var(--imy3-text-on-success);
}

.imy3-btn--success:hover:not(:disabled) {
  background: var(--imy3-success-hover);
}

.imy3-btn--icon {
  width: var(--imy3-touch);
  min-width: var(--imy3-touch);
  padding: 0;
}

.imy3-btn:disabled,
.imy3-btn[aria-disabled="true"],
.imy3-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.imy3-btn--loading {
  pointer-events: none;
  position: relative;
  color: transparent;
}

.imy3-btn--loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--imy3-text-on-brand);
  animation: imy3-spin var(--imy3-dur-slow) linear infinite;
}

.imy3-btn--secondary.imy3-btn--loading::after,
.imy3-btn--ghost.imy3-btn--loading::after {
  color: var(--imy3-text-secondary);
}

/* ==========================================================================
   4. FAB
   ========================================================================== */

.imy3-fab {
  box-sizing: border-box;
  width: var(--imy3-fab);
  height: var(--imy3-fab);
  min-width: var(--imy3-touch);
  min-height: var(--imy3-touch);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--imy3-radius-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  box-shadow: var(--imy3-shadow-map);
  transition: transform var(--imy3-dur-fast) var(--imy3-ease-standard),
    box-shadow var(--imy3-dur-fast) var(--imy3-ease-standard),
    opacity var(--imy3-dur-fast) var(--imy3-ease-standard);
}

.imy3-fab:focus-visible {
  outline: none;
  box-shadow: var(--imy3-shadow-map), var(--imy3-shadow-focus);
}

.imy3-fab:active:not(:disabled) {
  transform: scale(0.96);
}

.imy3-fab__icon {
  width: var(--imy3-icon);
  height: var(--imy3-icon);
  display: block;
  pointer-events: none;
}

.imy3-fab--primary,
.imy3-fab--parking {
  background: #1f1f1f;
  color: var(--imy3-text-on-brand);
}

.imy3-fab--carpool {
  background: var(--imy3-info-tint);
  color: var(--imy3-info);
  border-color: #c7dbf5;
}

.imy3-fab--location {
  background: var(--imy3-surface-raised);
  color: var(--imy3-info);
  border-color: var(--imy3-border);
}

.imy3-fab--emergency {
  background: var(--imy3-danger);
  color: var(--imy3-text-on-danger);
}

.imy3-fab--selected {
  box-shadow: var(--imy3-shadow-map), 0 0 0 2px var(--imy3-brand);
}

.imy3-fab--disabled,
.imy3-fab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Emergency: press feedback only. No pulse / halo / playful loop. */

/* ==========================================================================
   5. CHIP
   ========================================================================== */

.imy3-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--imy3-touch);
  padding: 0 var(--imy3-space-12);
  border-radius: var(--imy3-radius-pill);
  border: 1.5px solid var(--imy3-border);
  background: var(--imy3-surface-raised);
  color: var(--imy3-text-secondary);
  font-family: var(--imy3-font);
  font-size: var(--imy3-fs-label);
  font-weight: var(--imy3-fw-medium);
  cursor: pointer;
  gap: var(--imy3-chip-gap);
}

.imy3-chip--selected {
  background: var(--imy3-brand-tint);
  border-color: var(--imy3-brand);
  color: var(--imy3-brand-hover);
}

.imy3-chip--success {
  background: var(--imy3-success-tint);
  border-color: #86efac;
  color: var(--imy3-success-ink);
}

.imy3-chip--warning {
  background: var(--imy3-warning-tint);
  border-color: #fcd34d;
  color: var(--imy3-warning-ink);
}

.imy3-chip--danger {
  background: var(--imy3-danger-tint);
  border-color: #fecaca;
  color: var(--imy3-danger-ink);
}

.imy3-chip:focus-visible {
  outline: none;
  box-shadow: var(--imy3-shadow-focus);
}

/* ==========================================================================
   6. INPUT
   ========================================================================== */

.imy3-field {
  display: flex;
  flex-direction: column;
  gap: var(--imy3-space-6);
}

.imy3-input,
.imy3-select,
.imy3-textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--imy3-touch);
  padding: var(--imy3-space-12) var(--imy3-space-12);
  border: 1.5px solid var(--imy3-border);
  border-radius: var(--imy3-radius-sm);
  background: var(--imy3-surface-raised);
  color: var(--imy3-text-primary);
  font-family: var(--imy3-font);
  font-size: var(--imy3-fs-body);
  line-height: var(--imy3-lh-ui);
}

.imy3-input--numeric,
.imy3-input--phone {
  font-family: var(--imy3-font-numeric);
  font-variant-numeric: tabular-nums;
}

.imy3-input--search {
  padding-left: var(--imy3-space-32);
}

.imy3-textarea {
  min-height: 96px;
  resize: vertical;
}

.imy3-input:focus-visible,
.imy3-select:focus-visible,
.imy3-textarea:focus-visible {
  outline: none;
  border-color: var(--imy3-focus);
  box-shadow: var(--imy3-shadow-focus);
}

.imy3-input--error,
.imy3-select--error,
.imy3-textarea--error {
  border-color: var(--imy3-danger);
}

.imy3-field__error {
  font-size: var(--imy3-fs-caption);
  color: var(--imy3-danger);
}

.imy3-input:disabled,
.imy3-select:disabled,
.imy3-textarea:disabled,
.imy3-input--disabled {
  background: var(--imy3-neutral-fill);
  color: var(--imy3-text-muted);
  cursor: not-allowed;
}

.imy3-input[readonly],
.imy3-input--readonly {
  background: var(--imy3-surface-2);
}

/* ==========================================================================
   7. TOGGLE / SLIDER
   ========================================================================== */

.imy3-toggle {
  position: relative;
  width: 52px;
  height: 32px;
  min-width: 52px;
  border: 0;
  border-radius: var(--imy3-radius-pill);
  background: var(--imy3-neutral);
  cursor: pointer;
  flex-shrink: 0;
}

.imy3-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--imy3-shadow-card);
  transition: transform var(--imy3-dur-normal) var(--imy3-ease-standard);
}

.imy3-toggle--on {
  background: var(--imy3-success);
}

.imy3-toggle--on::after {
  transform: translateX(20px);
}

.imy3-toggle:disabled,
.imy3-toggle--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.imy3-toggle:focus-visible {
  outline: none;
  box-shadow: var(--imy3-shadow-focus);
}

.imy3-slider {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--imy3-brand);
}

.imy3-slider--eta {
  accent-color: var(--imy3-info);
}

/* ==========================================================================
   8. BADGE / CARD
   ========================================================================== */

.imy3-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--imy3-space-8);
  border-radius: var(--imy3-radius-pill);
  font-size: var(--imy3-fs-caption);
  font-weight: var(--imy3-fw-bold);
  background: var(--imy3-neutral-fill);
  color: var(--imy3-text-secondary);
}

.imy3-badge--status {
  background: var(--imy3-info-tint);
  color: var(--imy3-info-ink);
}

.imy3-badge--count,
.imy3-badge--money,
.imy3-badge--eta {
  font-family: var(--imy3-font-numeric);
  font-variant-numeric: tabular-nums;
}

.imy3-badge--money {
  background: var(--imy3-brand-tint);
  color: var(--imy3-brand-hover);
}

.imy3-badge--eta {
  background: var(--imy3-info-tint);
  color: var(--imy3-info-ink);
}

.imy3-badge--new {
  background: var(--imy3-success-tint);
  color: var(--imy3-success-ink);
}

.imy3-badge--warning {
  background: var(--imy3-warning-tint);
  color: var(--imy3-warning-ink);
}

.imy3-card {
  box-sizing: border-box;
  padding: var(--imy3-card-pad);
  border: 1px solid var(--imy3-border);
  border-radius: var(--imy3-radius-lg);
  background: var(--imy3-surface-raised);
  box-shadow: var(--imy3-shadow-card);
}

.imy3-card--interactive {
  cursor: pointer;
}

.imy3-card--interactive:focus-visible {
  outline: none;
  box-shadow: var(--imy3-shadow-card), var(--imy3-shadow-focus);
}

.imy3-card--map {
  background: var(--imy3-surface-raised);
  box-shadow: var(--imy3-shadow-map);
}

.imy3-card--status {
  background: var(--imy3-surface);
}

.imy3-card--empty,
.imy3-card--summary {
  background: var(--imy3-surface-2);
}

/* ==========================================================================
   9. SHEET / MODAL / TOAST / COACH
   ========================================================================== */

.imy3-overlay {
  position: fixed;
  inset: 0;
  background: var(--imy3-overlay);
  z-index: var(--imy3-z-sheet);
}

.imy3-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--imy3-z-sheet);
  padding: var(--imy3-sheet-pad);
  padding-bottom: calc(var(--imy3-sheet-pad) + var(--imy3-safe-bottom));
  border-radius: var(--imy3-radius-sheet);
  background: var(--imy3-surface);
  box-shadow: var(--imy3-shadow-sheet);
}

.imy3-sheet--full {
  top: var(--imy3-safe-top);
  border-radius: 0;
}

.imy3-dialog {
  box-sizing: border-box;
  width: min(100%, 400px);
  padding: var(--imy3-dialog-pad);
  border-radius: var(--imy3-radius-lg);
  background: var(--imy3-surface);
  box-shadow: var(--imy3-shadow-modal);
}

.imy3-dialog__actions {
  display: flex;
  gap: var(--imy3-btn-gap);
  margin-top: var(--imy3-space-16);
}

.imy3-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--imy3-space-24) + var(--imy3-safe-bottom));
  transform: translateX(-50%);
  z-index: var(--imy3-z-toast);
  max-width: min(92vw, 420px);
  padding: var(--imy3-space-12) var(--imy3-space-16);
  border-radius: var(--imy3-radius-md);
  background: #1f1f1f;
  color: #fff;
  font-size: var(--imy3-fs-body-sm);
  box-shadow: var(--imy3-shadow-floating);
}

.imy3-toast--success {
  background: var(--imy3-success-ink);
}

.imy3-toast--warning {
  background: var(--imy3-warning-ink);
}

.imy3-toast--error {
  background: var(--imy3-danger-ink);
}

.imy3-coach {
  position: fixed;
  inset: 0;
  z-index: var(--imy3-z-coach);
  pointer-events: none;
}

.imy3-coach__tip {
  pointer-events: auto;
  max-width: 280px;
  padding: var(--imy3-space-16);
  border-radius: var(--imy3-radius-md);
  background: var(--imy3-surface-raised);
  box-shadow: var(--imy3-shadow-modal);
}

/* ==========================================================================
   10. EMPTY / LOADING / STATUS
   ========================================================================== */

.imy3-empty {
  text-align: center;
  padding: var(--imy3-space-32) var(--imy3-space-16);
  color: var(--imy3-text-secondary);
}

.imy3-empty__title {
  font-size: var(--imy3-fs-h3);
  font-weight: var(--imy3-fw-bold);
  color: var(--imy3-text-primary);
  margin: 0 0 var(--imy3-space-8);
}

.imy3-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--imy3-border);
  border-top-color: var(--imy3-brand);
  border-radius: 50%;
  animation: imy3-spin var(--imy3-dur-slow) linear infinite;
}

.imy3-status {
  padding: var(--imy3-space-12) var(--imy3-space-16);
  border-radius: var(--imy3-radius-md);
  border: 1px solid var(--imy3-border);
}

.imy3-status--success {
  background: var(--imy3-success-tint);
  border-color: #86efac;
  color: var(--imy3-success-ink);
}

.imy3-status--error {
  background: var(--imy3-danger-tint);
  border-color: #fecaca;
  color: var(--imy3-danger-ink);
}

.imy3-icon {
  width: var(--imy3-icon);
  height: var(--imy3-icon);
  stroke: currentColor;
  fill: none;
  stroke-width: var(--imy3-icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.imy3-icon--fill {
  fill: currentColor;
  stroke: none;
}

.imy3-icon--sm {
  width: var(--imy3-icon-sm);
  height: var(--imy3-icon-sm);
}

.imy3-icon--danger {
  color: var(--imy3-danger);
}

.imy3-icon--emergency {
  color: var(--imy3-text-on-danger);
}

@keyframes imy3-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .imy3-btn,
  .imy3-fab,
  .imy3-toggle::after,
  .imy3-spinner,
  .imy3-btn--loading::after {
    transition: none;
    animation: none;
  }
}
