/* ═══════════════════════════════════════════════════════════════════════════
   QUEUING SYSTEM SIMULATOR
   Dark: Mission Control | Light: Swiss Design
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ─────────────────────────────────────────────────────────────────────────────
   CSS VARIABLES - DARK THEME (Mission Control)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Core palette - neutral grays */
  --bg-deep: #0a0a0a;
  --bg-panel: #111111;
  --bg-card: #161616;
  --bg-elevated: #1c1c1c;

  /* Purple accent spectrum */
  --accent-primary: #a78bfa;
  --accent-secondary: #7c3aed;
  --accent-muted: #6d28d9;

  /* Semantic colors - muted */
  --accent-success: #4ade80;
  --accent-warning: #fbbf24;
  --accent-danger: #f87171;

  /* Text hierarchy */
  --text-bright: #fafafa;
  --text-primary: #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-muted: #525252;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(167, 139, 250, 0.4);

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

  /* Typography */
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
  --font-swiss: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* Animation */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Mission Control Effects */
  --glow-primary: 0 0 20px rgba(167, 139, 250, 0.25);
  --glow-primary-intense: 0 0 30px rgba(167, 139, 250, 0.4);
  --glow-primary-subtle: 0 0 10px rgba(167, 139, 250, 0.15);

  /* Subtle grid pattern for dark theme */
  --bg-grid: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0V0zm1 1v38h38V1H1z' fill='%23ffffff' fill-opacity='0.02'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────────────────────────────────────
   LIGHT THEME (Swiss Design)
   Classic Swiss: Red accent, Inter typography, maximum clarity
   ───────────────────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  /* Swiss palette - pure whites */
  --bg-deep: #ffffff;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #fafafa;

  /* Swiss red accent */
  --accent-primary: #e53935;
  --accent-secondary: #c62828;
  --accent-muted: #ef5350;

  /* Semantic colors - Swiss precision */
  --accent-success: #2e7d32;
  --accent-warning: #f57c00;
  --accent-danger: #c62828;

  /* High contrast text */
  --text-bright: #000000;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;

  /* Clean borders */
  --border-subtle: #e0e0e0;
  --border-accent: #e53935;

  /* Swiss typography */
  --font-display: var(--font-swiss);

  /* No glow effects in Swiss Design */
  --glow-primary: none;
  --glow-primary-intense: none;
  --glow-primary-subtle: none;

  /* No grid pattern */
  --bg-grid: none;
}

/* Swiss Design: Remove decorative elements */
[data-theme="light"] h2::before {
  display: none;
}

/* Swiss scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f5f5f5;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #bdbdbd;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #9e9e9e;
}

/* Swiss selection */
[data-theme="light"] ::selection {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Swiss panels - clean borders, no shadows */
[data-theme="light"] .panel,
[data-theme="light"] .result,
[data-theme="light"] .notice {
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

[data-theme="light"] .param-group {
  background: #fafafa;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] pre {
  background: #fafafa;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] canvas {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

/* Swiss inputs - clean and precise */
[data-theme="light"] input[type="number"] {
  border: 1px solid #bdbdbd;
  background: #ffffff;
}

[data-theme="light"] input[type="number"]:focus {
  border-color: var(--accent-primary);
  box-shadow: none;
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

/* Swiss buttons - solid and functional */
[data-theme="light"] button {
  font-family: var(--font-swiss);
  font-weight: 600;
}

[data-theme="light"] button:hover {
  background: var(--accent-secondary);
  color: #ffffff;
}

/* Swiss navigation */
[data-theme="light"] .nav-item--active {
  background: transparent;
  color: var(--accent-primary);
  position: relative;
}

[data-theme="light"] .nav-item--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-md);
  right: var(--space-md);
  height: 2px;
  background: var(--accent-primary);
}

[data-theme="light"] .nav-logo {
  background: var(--accent-primary);
}

[data-theme="light"] .theme-icon--sun {
  color: var(--accent-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BASE RESET & FOUNDATION
   ───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg-deep);
  background-image: var(--bg-grid);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CONTAINER & LAYOUT
   ───────────────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
  position: relative; /* For mobile nav menu positioning */

  /* Fade in animation */
  animation: containerFadeIn 0.6s ease-out;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   TYPOGRAPHY
   ───────────────────────────────────────────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  margin-bottom: var(--space-lg);
  text-align: left;

  /* Mission Control: subtle text glow */
  text-shadow: 0 0 40px rgba(167, 139, 250, 0.15);

  /* Glowing underline */
  position: relative;
  padding-bottom: var(--space-md);
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 1px;
  box-shadow: var(--glow-primary-subtle);
}

/* Swiss Design: clean h1 */
[data-theme="light"] h1 {
  text-shadow: none;
  font-family: var(--font-swiss);
  font-weight: 700;
  letter-spacing: -0.03em;
}

[data-theme="light"] h1::after {
  box-shadow: none;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.08em;

  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

h2::before {
  content: '//';
  color: var(--accent-primary);
  font-family: var(--font-mono);
  text-shadow: var(--glow-primary-subtle);
}

/* Swiss Design: clean h2 */
[data-theme="light"] h2 {
  font-family: var(--font-swiss);
  font-weight: 700;
  letter-spacing: 0.05em;
}

h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-panel);
  color: var(--text-secondary);
  padding: var(--space-md);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FORM ELEMENTS
   ───────────────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
  position: relative;
}

label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

input[type="number"] {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-bright);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  transition: all var(--transition-fast);

  /* Remove default spinner on some browsers */
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2), var(--glow-primary-subtle);
  background: var(--bg-elevated);
}

input[type="number"]:hover:not(:focus) {
  border-color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
button {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);

  background: var(--accent-primary);
  color: var(--bg-deep);
}

button:hover {
  background: var(--text-bright);
  box-shadow: var(--glow-primary);
}

button:active {
  transform: translateY(1px);
  box-shadow: var(--glow-primary-subtle);
}

.btn-success {
  background: var(--accent-success);
}

.btn-success:hover {
  background: #86efac;
}

.btn-small {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.8rem;
}

.full-width {
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CARDS & PANELS
   ───────────────────────────────────────────────────────────────────────────── */
.result {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.result h3 {
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.defaults {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-top: var(--space-xl);
}

.defaults p {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: var(--space-xs) 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MISSION CONTROL: Corner Bracket Accents
   ───────────────────────────────────────────────────────────────────────────── */
.panel {
  position: relative;
}

.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-primary);
  opacity: 0.6;
  pointer-events: none;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 4px;
}

.panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 4px;
}

/* Swiss Design: No corner brackets */
[data-theme="light"] .panel::before,
[data-theme="light"] .panel::after {
  display: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   NOTICE / ALERT BOXES
   ───────────────────────────────────────────────────────────────────────────── */
.notice {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;

  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;

  font-size: 0.875rem;
  color: var(--text-primary);
}

.notice strong {
  color: var(--accent-primary);
}

.notice a {
  color: var(--accent-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   NAVIGATION LINKS
   ───────────────────────────────────────────────────────────────────────────── */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-primary);
  text-decoration: none;
  margin-top: var(--space-xl);
  padding: var(--space-sm) 0;
  transition: all var(--transition-fast);
  border-bottom: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-bright);
  border-bottom-color: var(--accent-primary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--text-bright);
  text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────────────────────
   HEADER NAVIGATION
   ───────────────────────────────────────────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  margin: 0 calc(-1 * var(--space-xl));
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-deep);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bg-deep);
  background: var(--accent-primary);
  padding: 6px 10px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.nav-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  display: none;
}

@media (min-width: 640px) {
  .nav-title {
    display: block;
  }
}

/* Navigation Links */
.nav-links {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-xs);
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
    flex: 1;
    justify-content: center;
  }
}

.nav-links--open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 72px;
  left: var(--space-md);
  right: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-sm);
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
}

[data-theme="light"] .nav-links--open {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.nav-item {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-bright);
  background: var(--bg-elevated);
  text-decoration: none;
}

.nav-item--active {
  color: var(--accent-primary);
  background: rgba(167, 139, 250, 0.1);
  box-shadow: var(--glow-primary-subtle);
}

/* Responsive nav labels */
.nav-item-short {
  display: none;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .nav-item-full {
    display: none;
  }
  .nav-item-short {
    display: inline;
  }
}

@media (min-width: 1024px) {
  .nav-item-full {
    display: inline;
  }
  .nav-item-short {
    display: none;
  }
}

/* Mobile menu toggle */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.nav-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
}

.nav-toggle-icon {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: all var(--transition-fast);
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  left: 0;
  transition: all var(--transition-fast);
}

.nav-toggle-icon::before {
  top: -6px;
}

.nav-toggle-icon::after {
  top: 6px;
}

/* Hamburger to X animation */
.nav-toggle--active .nav-toggle-icon {
  background: transparent;
}

.nav-toggle--active .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle--active .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
}

.theme-toggle:hover .theme-icon {
  color: var(--accent-primary);
}

.theme-icon {
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

/* Show moon in dark mode, sun in light mode */
.theme-icon--sun {
  display: none;
}

.theme-icon--moon {
  display: block;
}

[data-theme="light"] .theme-icon--sun {
  display: block;
  color: var(--accent-warning);
}

[data-theme="light"] .theme-icon--moon {
  display: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   THEME TRANSITIONS
   ───────────────────────────────────────────────────────────────────────────── */
body,
.container,
.panel,
.param-group,
.chart-card,
.result,
.defaults,
.notice,
.site-nav,
pre,
canvas,
input[type="number"] {
  transition: background-color var(--transition-base),
              border-color var(--transition-base),
              color var(--transition-base);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CHARTS
   ───────────────────────────────────────────────────────────────────────────── */
canvas {
  display: block;
  margin-top: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: var(--space-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY CLASSES
   ───────────────────────────────────────────────────────────────────────────── */
.mb-10 {
  margin-bottom: var(--space-sm);
}

.ml-10 {
  margin-left: var(--space-sm);
}

.mt-20 {
  margin-top: var(--space-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   LAYOUT GRID (for forms)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md) var(--space-xl);
  }

  .form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md) var(--space-xl);
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   STATUS INDICATORS
   ───────────────────────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: var(--space-sm);
}

.status-dot.active {
  background: var(--accent-primary);
}

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

.status-dot.error {
  background: var(--accent-danger);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SCROLLBAR STYLING
   ───────────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-panel);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SELECTION STYLING
   ───────────────────────────────────────────────────────────────────────────── */
::selection {
  background: var(--accent-primary);
  color: var(--bg-deep);
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: var(--space-md);
  }

  h1 {
    font-size: 1.5rem;
  }

  canvas {
    max-width: 100%;
    height: auto !important;
  }
}
