/* Windows 98 Theme CSS */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* ===== SCALING SYSTEM ===== */
  /* Master controls - change these to scale everything */
  --base-font-size: 11px;
  --scale-ratio: 1.125;
  --line-height-base: 1.4;
  
  /* ===== TYPOGRAPHY SCALE ===== */
  /* Using rem units - all scale with html font-size */
  --font-xs: 0.77rem;   /* ~10px when html is 13px */
  --font-sm: 0.88rem;   /* ~11.5px */
  --font-base: 1rem;    /* 13px - matches html font-size */
  --font-md: 1.125rem;  /* ~14.6px */
  --font-lg: 1.27rem;   /* ~16.5px */
  --font-xl: 1.42rem;   /* ~18.5px */
  --font-xxl: 1.6rem;   /* ~20.8px */
  
  /* ===== SPACING SCALE ===== */
  /* Based on rem units for consistent scaling */
  --space-xs: 0.25rem; /* 4px */
  --space-sm: 0.5rem;  /* 8px */
  --space-md: 0.75rem; /* 12px */
  --space-lg: 1rem;    /* 16px */
  --space-xl: 1.5rem;  /* 24px */
  --space-xxl: 2rem;   /* 32px */
  
  /* ===== COMPONENT DIMENSIONS ===== */
  /* Calculated based on rem units - scale with root font-size */
  --input-height: calc(var(--font-sm) * var(--line-height-base) + var(--space-md));
  --button-height: calc(1rem * var(--line-height-base) + var(--space-md));
  --progress-height: calc(1rem + var(--space-xs));
  --log-height: calc(1rem * var(--line-height-base) * 16); /* ~16 lines - even taller */
  
  /* Windows 98 Color Palette */
  --win98-face: #C3C3C3;
  --win98-shadow: #818181;
  --win98-highlight: #FDFFFF;
  --win98-accent: #000080;
  --win98-window-bg: #C0C0C0;
  --win98-text: #000000;
  --win98-gray-dark: #808080;
  --win98-gray-light: #E0E0E0;
  
  /* Task Manager inspired colors */
  --taskman-bg: #000000;
  --taskman-green: #00FF00;
  --taskman-red: #FF0000;
  
  /* Status colors */
  --status-good: #008000;
  --status-warning: #FFFF00;
  --status-error: #FF0000;
}

/* ===== PIXEL-PERFECT RENDERING ===== */
html:root {
  /* Higher specificity selector - this controls rem scaling */
  font-size: 11px; /* 1rem = 11px - authentic Win98 8pt */  
}

html {
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  font-smooth: never;
  -moz-osx-font-smoothing: unset;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "MS Sans Serif", "Tahoma", system-ui, sans-serif;
  font-size: var(--font-base);
  line-height: var(--line-height-base);
  background-color: #008080; /* Teal canvas background */
  color: var(--win98-text);
  overflow-x: hidden;
}

/* ===== CORE BEVELING PATTERNS ===== */
/* Raised elements - toolbars, buttons, dialog frames */
.win98-raised {
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  background-color: var(--win98-face);
}

/* Sunken elements - content areas, input fields */
.win98-sunken {
  border: 2px solid;
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  background-color: var(--win98-window-bg);
}

/* Legacy compatibility classes removed - use .win98-raised and .win98-sunken instead */

/* ===== MAIN CONTAINER ===== */
.main-container {
  max-width: 1200px;
  margin: 16px auto;
  padding: 16px;
  background-color: var(--win98-face);
  /* Windows 98 app window beveling */
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  /* Subtle drop shadow */
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(90deg, var(--win98-accent) 0%, #4080C0 100%);
  color: white;
  padding: 4px 8px;
  margin-bottom: 8px;
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
}

.header h1 {
  font-size: var(--font-lg);
  font-weight: bold;
  margin: 0 0 var(--space-xs) 0;
  color: white;
  text-align: left;
}

.subtitle {
  font-size: var(--font-sm);
  color: #E0E0E0;
  margin: 0;
  text-align: left;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-dialog {
  background-color: var(--win98-face);
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  padding: 16px;
  max-width: 320px;
  width: 90%;
}

.loading-title {
  font-size: var(--font-md);
  font-weight: bold;
  margin: 0 0 var(--space-md) 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-sm);
  color: var(--win98-text);
  margin-bottom: var(--space-xs);
}

.progress-bar-container {
  width: 100%;
  height: 20px;
  border: 2px solid;
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  background-color: var(--win98-window-bg);
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background-color: var(--win98-accent);
  width: var(--progress-width, 0%);
  transition: width 0.3s ease;
}

.loading-description {
  font-size: var(--font-sm);
  color: var(--win98-text);
  text-align: center;
  margin: 0;
}

.loading-note {
  font-size: var(--font-xs);
  color: var(--win98-text);
}

/* ===== CONTROL PANEL ===== */
.control-panel {
  /* Control panel is a toolbar - raised */
  background-color: var(--win98-face);
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  padding: 8px;
  margin-bottom: 8px;
}

.control-group {
  display: table;
  width: 100%;
  border-spacing: 8px 0;
}

.scenario-group,
.prompt-group,
.button-group {
  display: table-cell;
  vertical-align: top;
}

.scenario-group {
  width: 200px;
}

.prompt-group {
  width: auto;
}

.button-group {
  width: 120px;
  vertical-align: top;
}

.control-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: bold;
  color: var(--win98-text);
  margin-bottom: var(--space-xs);
}

.control-select,
.control-textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--font-base); /* Increased from --font-sm to --font-base */
  border: 2px solid;
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  background-color: white;
  color: var(--win98-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.control-select {
  height: var(--input-height);
  line-height: var(--line-height-base);
}

.control-textarea {
  resize: vertical;
  min-height: calc(var(--input-height) * 2);
  line-height: var(--line-height-base);
}

.control-select:focus,
.control-textarea:focus {
  outline: 1px dotted var(--win98-text);
  outline-offset: -3px;
}

/* ===== BUTTONS ===== */
.run-button {
  font-family: inherit;
  font-size: var(--font-base);
  font-weight: bold;
  background-color: var(--win98-face);
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  color: var(--win98-text);
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  min-height: var(--button-height);
}

.run-button:hover {
  background-color: var(--win98-gray-light);
}

.run-button:active {
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  background-color: var(--win98-gray-dark);
}

.run-button:disabled {
  color: var(--win98-gray-dark);
  cursor: default;
}

/* ===== AGENT COMPARISON ===== */
.agent-comparison {
  display: table;
  width: 100%;
  border-spacing: 8px 0;
  margin-bottom: 8px;
}

/* Agent card styles moved to race.css to avoid conflicts */

.multi-pass-agent {
  /* Red accent for multi-pass */
}

.single-pass-agent {
  /* Green accent for single-pass */
}

.agent-header {
  padding: 6px;
  border-bottom: 1px solid var(--win98-shadow);
  background-color: var(--win98-face);
  color: var(--win98-text);
}

.agent-title {
  font-size: var(--font-base);
  font-weight: bold;
  margin: 0;
  display: flex;
  align-items: center;
}

/* Agent status styles moved to components/race.css */

.agent-body {
  padding: 6px;
}

/* Metrics grid moved to specific component files to avoid conflicts */

.metric-item {
  display: table-cell;
  text-align: center;
}

.metric-label {
  color: var(--win98-gray-dark);
  margin-bottom: var(--space-xs);
  font-size: var(--font-xs);
}

.metric-value {
  font-weight: bold;
  color: var(--win98-text);
}

.agent-progress {
  margin-bottom: 6px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-xs);
  color: var(--win98-gray-dark);
  margin-bottom: var(--space-xs);
}

.progress-container {
  width: 100%;
  height: 16px;
  border: 2px solid;
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  background-color: var(--win98-window-bg);
}

/* Progress fill moved to race.css to avoid conflicts - keep only base properties */

/* ===== AGENT LOGS ===== */
.agent-log {
  /* Keep the cool terminal look! */
  height: var(--log-height);
  overflow-y: auto;
  background-color: var(--taskman-bg);
  color: #C0C0C0; /* Neutral light gray */
  border: 2px solid;
  border-color: var(--win98-shadow) var(--win98-highlight) var(--win98-highlight) var(--win98-shadow);
  padding: 4px;
  font-family: "Courier New", monospace;
  font-size: var(--font-xs);
  line-height: 1.2;
}

/* Agent log colors moved to race.css to avoid redundancy */

.log-entry {
  margin-bottom: 2px;
  animation: fadeIn 0.3s ease-out;
}

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

/* ===== RACE RESULTS ===== */
.race-results {
  /* Race results is a dialog - raised */
  background-color: var(--win98-face);
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  padding: 12px;
  margin-bottom: 8px;
}

.race-results h3 {
  font-size: var(--font-md);
  font-weight: bold;
  margin: 0 0 var(--space-sm) 0;
  text-align: center;
}

.winner-announcement {
  text-align: center;
  font-size: var(--font-xl);
  font-weight: bold;
  margin-bottom: var(--space-sm);
}

.results-grid {
  display: table;
  width: 100%;
  border-spacing: var(--space-sm);
  text-align: center;
  font-size: var(--font-sm);
}

.result-item {
  display: table-cell;
}

.result-label {
  color: var(--win98-gray-dark);
  margin-bottom: var(--space-xs);
  font-size: var(--font-xs);
}

.result-value {
  font-size: var(--font-lg);
  font-weight: bold;
}

/* Tab styles moved to components/tabs.css */

/* Uncertainty styles moved to components/uncertainty.css */


/* ===== RESPONSIVE BEHAVIOR ===== */
@media (max-width: 768px) {
  .control-group {
    display: block;
  }
  
  .scenario-group,
  .prompt-group,
  .button-group {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }
  
  .agent-comparison {
    display: block;
  }
  
  .agent-card {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }
  
  .results-grid {
    display: block;
  }
  
  .result-item {
    display: block;
    margin-bottom: 8px;
  }
}

/* ===== STATUS INDICATORS ===== */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  margin-right: 4px;
}

.status-good {
  background-color: var(--status-good);
}

.status-warning {
  background-color: var(--status-warning);
}

.status-error {
  background-color: var(--status-error);
}

/* ===== SCROLLBARS (WebKit) ===== */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background-color: var(--win98-face);
  border: 1px solid var(--win98-shadow);
}

::-webkit-scrollbar-thumb {
  background-color: var(--win98-gray-light);
  border: 1px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--win98-highlight);
}

::-webkit-scrollbar-corner {
  background-color: var(--win98-face);
}

/* ===== UTILITY CLASSES ===== */
/* State management utilities */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.loading-state {
  opacity: 0.6;
  pointer-events: none;
}

.error-state {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.disabled-state {
  opacity: 0.5;
  pointer-events: none;
}

.demo-opacity {
  opacity: 0.3;
}

.metrics-loading {
  opacity: 0.5;
}

.progress-error {
  background-color: #dc2626 !important;
}

/* Dynamic property utilities */
.progress-bar-dynamic {
  width: var(--progress-width, 0%);
  transition: width 0.3s ease;
}

.confidence-bar-dynamic {
  width: var(--confidence-width, 0%);
  transition: width 0.5s ease;
}

/* Distribution bar color variants */
.dist-bar-1 { background: hsl(120, 100%, 50%); }
.dist-bar-2 { background: hsl(90, 100%, 50%); }
.dist-bar-3 { background: hsl(60, 100%, 50%); }
.dist-bar-4 { background: hsl(30, 100%, 50%); }
.dist-bar-5 { background: hsl(0, 100%, 50%); }

/* Token confidence levels - replacing inline HSL */
.token-confidence-very-high {
  background-color: hsl(120, 80%, 45%);
  color: black;
  font-weight: bold;
}

.token-confidence-high {
  background-color: hsl(100, 80%, 40%);
  color: black;
  font-weight: bold;
}

.token-confidence-good {
  background-color: hsl(90, 80%, 40%);
  color: black;
  font-weight: bold;
}

.token-confidence-medium {
  background-color: hsl(60, 80%, 35%);
  color: black;
  font-weight: bold;
}

.token-confidence-low {
  background-color: hsl(30, 80%, 30%);
  color: black;
  font-weight: bold;
}

.token-confidence-very-low {
  background-color: hsl(0, 80%, 30%);
  color: black;
  font-weight: bold;
}

/* ===== DEMO MODE NOTICE ===== */
.demo-notice {
  background-color: #FFFACD;
  border: 2px solid;
  border-color: var(--win98-highlight) var(--win98-shadow) var(--win98-shadow) var(--win98-highlight);
  padding: 8px;
  margin-bottom: 8px;
  text-align: center;
}

.demo-notice-title {
  font-weight: bold;
  color: #B8860B;
  margin-bottom: 4px;
}

.demo-notice-text {
  font-size: 10px;
  color: var(--win98-gray-dark);
}