/* ==============================================================================
   Avyay Intellitech - Autonomous Diamond Polishing Robotic Workcell
   Design Standard: Ultra-Precision Industrial Cleanroom Instrument (Zeiss / KUKA style)
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Rich Cleanroom Titanium & Graphite Palette */
  --bg-core: #090b0e;
  --bg-primary: #0f1217;
  --bg-secondary: #161b22;
  --bg-surface: #1e2430;
  --bg-card: rgba(22, 27, 36, 0.85);
  --bg-card-hover: rgba(30, 36, 48, 0.95);
  --bg-glass: rgba(15, 18, 23, 0.92);
  --bg-overlay: rgba(6, 8, 11, 0.88);

  /* Hairlines & Specular Gradients */
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-focus: #3b82f6;
  --border-nominal: rgba(16, 185, 129, 0.4);

  /* High-Contrast Typographic Hierarchy */
  --text-pure: #ffffff;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-mono: #f1f5f9;

  /* Precision Engineering Accents */
  --accent-nominal: #10b981;  /* Calibrated Emerald */
  --accent-cyan: #38bdf8;     /* Laser Cyan */
  --accent-blue: #3b82f6;     /* Precision Cobalt */
  --accent-amber: #f59e0b;    /* Warning Amber */
  --accent-alert: #ef4444;    /* Security Crimson */

  /* Dimensions */
  --top-bar-height: 58px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-core);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Atmospheric Grid */
.bg-grid-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 85%);
  z-index: 1;
}

/* Common Typographic Utilities */
.mono {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.01em;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-nominal { color: var(--accent-nominal); }
.text-cyan { color: var(--accent-cyan); }
.text-alert { color: var(--accent-alert); }
.text-amber { color: var(--accent-amber); }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity var(--transition-smooth), transform var(--transition-smooth), visibility var(--transition-smooth);
}

.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.985);
}

/* Precision Buttons */
.btn-precision {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-pure);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn-precision:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--text-pure);
  transform: translateY(-1px);
}

.btn-precision.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-precision.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #93c5fd;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-precision:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==============================================================================
   SCREEN 1: Client Access & 2FA Gate
   ============================================================================== */
#auth-screen {
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 38%, #161c26 0%, #080a0d 80%);
  padding: 24px;
}

.auth-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
}

.auth-card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all var(--transition-smooth);
}

.auth-top-crest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.company-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.indicator-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-nominal);
  box-shadow: 0 0 10px var(--accent-nominal);
}

.security-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
}

.auth-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-pure);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

/* Password Form */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-precision {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background-color: #0b0e13;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  letter-spacing: 0.04em;
  outline: none;
  transition: all var(--transition-fast);
}

.input-precision:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background-color: #0e1218;
}

.security-notice-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.security-notice-box svg {
  flex-shrink: 0;
  color: var(--accent-cyan);
}

.error-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.error-banner.active {
  display: block;
}

/* ==============================================================================
   SCREEN 2: Dedicated Executive Welcome & Briefing Dossier
   ============================================================================== */
#welcome-screen {
  z-index: 80;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 10%, #151b24 0%, #090b0e 70%);
  padding: 60px 32px;
}

.welcome-container {
  max-width: 1020px;
  margin: 0 auto;
}

.doc-header {
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 30px;
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.doc-branding h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin-bottom: 6px;
}

.doc-branding p {
  font-size: 16px;
  color: var(--text-secondary);
}

.doc-meta {
  text-align: right;
  font-size: 13px;
}

.confidential-tag {
  display: inline-block;
  padding: 4px 10px;
  background-color: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Executive Overview */
.overview-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 40px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* Benchmark Grid - Prominent & Dynamic */
.section-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
}

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 44px;
}

.benchmark-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.benchmark-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-nominal), var(--accent-cyan));
}

.benchmark-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.benchmark-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.benchmark-val {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.benchmark-sub {
  font-size: 12px;
  color: var(--accent-cyan);
  line-height: 1.4;
}

/* Architecture Specs Table */
.spec-table-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 44px;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.spec-table th, .spec-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.spec-table th {
  background-color: rgba(255, 255, 255, 0.025);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.spec-table td.spec-param {
  color: var(--text-pure);
  font-weight: 600;
  width: 25%;
}

.spec-table td.spec-val {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-cyan);
  font-weight: 600;
  width: 30%;
}

.spec-table td.spec-desc {
  color: var(--text-secondary);
}

.welcome-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 24px;
  border-top: 1px solid var(--border-medium);
}

/* ==============================================================================
   SCREEN 3: Bilateral NDA Modal & Asset Preloader
   ============================================================================== */
#nda-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background-color: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

#nda-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nda-card {
  width: 100%;
  max-width: 680px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
}

.nda-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nda-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.nda-body {
  padding: 28px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.nda-terms-box {
  background-color: #0a0d12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px;
  max-height: 160px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.preloader-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.preloader-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.preloader-track {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.preloader-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 120ms linear;
}

.preloader-status {
  font-size: 12px;
  color: var(--text-muted);
}

.nda-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

/* ==============================================================================
   SCREEN 4: Industrial 3D Viewport & HUD
   ============================================================================== */
#app-viewport {
  z-index: 50;
  background-color: #090b0e;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  outline: none;
}

/* Top Perimeter Telemetry Strip */
.hud-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 60;
  user-select: none;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hud-brand {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-nominal);
}

.hud-telemetry-metrics {
  display: flex;
  align-items: center;
  gap: 28px;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
}

.telemetry-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.telemetry-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mono);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Camera Toolbar */
.camera-toolbar {
  position: absolute;
  top: calc(var(--top-bar-height) + 16px);
  left: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  gap: 6px;
  z-index: 60;
}

.btn-cam {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-cam:hover, .btn-cam.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
  color: #ffffff;
}

/* Robot Kinematic Motion Toolbar */
.motion-toolbar {
  position: absolute;
  top: calc(var(--top-bar-height) + 16px);
  right: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  gap: 6px;
  z-index: 60;
}

.btn-motion {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-motion:hover, .btn-motion.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

/* Left Subsystem Panel */
.subsystem-panel {
  position: absolute;
  top: calc(var(--top-bar-height) + 72px);
  left: 20px;
  width: 250px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  z-index: 60;
  font-size: 12px;
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.subsystem-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subsystem-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.subsystem-row .indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-nominal);
}

/* Bottom Event Feed */
.event-feed-panel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 720px;
  height: 96px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.event-feed-list {
  flex: 1;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.event-item .tag {
  color: var(--accent-cyan);
  font-weight: 700;
}

.event-item.nominal .tag {
  color: var(--accent-nominal);
}

.event-item.alert .tag {
  color: var(--accent-alert);
}
