/**
 * PJ_PIS - Morandi Industrial Modern Design System
 * Baseline Tokens & Performance-Constrained Industrial Stylesheet
 * 
 * Spec: SPEC-005 (Frontend Morandi Design System)
 * Guardrails: Low-spec PC optimized, ZERO blur filters / WebGL, strictly constrained shadows.
 */

:root,
:root[data-theme="morandi"] {
  /* --- Core Palette (Morandi Earth & Industrial Tones) --- */
  --color-primary: #C97A5E;
  --color-primary-dim: #9E5941;
  --color-sage: #778872;
  --color-olive: #4B5A3E;

  /* --- Surface Palette --- */
  --color-bg: #FAF9F6;
  --color-surface: #FFFFFF;
  --color-surface-2: #F4F7F2;
  --color-surface-3: #E8EDF2;

  /* --- Border Palette --- */
  --color-border: #D1D5DB;
  --color-border-muted: #E5E7EB;

  /* --- Typography / Text Hierarchy --- */
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-text-dim: #718096;

  /* --- Semantic Status Colors --- */
  --color-success: #2ECC71;
  --color-warning: #F39C12;
  --color-danger: #E74C3C;

  /* --- Spacing Scale --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* --- Border Radius --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* --- Low-Spec Industrial PC Friendly Shadows (Blur <= 12px) --- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 12px -2px rgba(0, 0, 0, 0.10);

  /* --- Typography Families --- */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Fira Code", monospace;

  /* --- Micro-Transition Tokens (GPU Accelerated transform & opacity only) --- */
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Future Theme Extensibility Placeholder: High Contrast Mode */
:root[data-theme="high-contrast"] {
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-2: #F0F0F0;
  --color-surface-3: #E0E0E0;
  --color-border: #000000;
  --color-border-muted: #333333;
  --color-text: #000000;
  --color-text-muted: #222222;
  --color-text-dim: #444444;
  --color-primary: #8A3B22;
  --color-primary-dim: #5C2312;
  --color-sage: #3C4E39;
  --color-olive: #222E1A;
  --color-success: #1E824C;
  --color-warning: #D35400;
  --color-danger: #C0392B;
}

/* ==========================================================================
   Base CSS Reset & Industrial Workstation Baseline
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Monospace Helpers for Tracking Numbers, Serial Numbers, and IDs */
.font-mono,
code,
kbd,
samp {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Full Viewport Application Shell (Zero Double Scrollbar)
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--color-bg);
}

.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   Utility & Semantic Surface Classes
   ========================================================================== */

.surface-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background-color: var(--color-surface-2);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.badge-warning {
  background-color: var(--color-surface-2);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.badge-danger {
  background-color: var(--color-surface-2);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* ==========================================================================
   PIS View Container — Full-Fill Base Class
   Used on all top-level PIS view components (ConfigStudioView,
   InspectionWorkbenchView, ReviewAuditCenterView, ProductionInspectionView).

   Uses position:absolute + inset:0 so that the view fills whatever space
   the TMP_WebServices host portal allocates, regardless of how the host
   positions its content panel (flex, grid, fixed-height div, iframe, etc.).
   ========================================================================== */

.pis-view-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  box-sizing: border-box;
}
