/* LONG DISTANCE SERVICES - Collect Call Operator Terminal CSS Style Sheet */

:root {
  /* Default monochrome white-on-black terminal design */
  --background: 0 0% 0%; /* Pure Black */
  --foreground: 0 0% 90%; /* Crisp white */
  --card: 0 0% 0%; /* Solid black */
  --card-foreground: 0 0% 90%;
  --popover: 0 0% 0%;
  --popover-foreground: 0 0% 92%;
  --primary: 0 0% 100%; /* Pure White */
  --primary-foreground: 0 0% 0%; /* Black */
  --secondary: 0 0% 8%; /* Dark Gray */
  --secondary-foreground: 0 0% 90%;
  --muted: 0 0% 4%;
  --muted-foreground: 0 0% 50%;
  --accent: 0 0% 100%;
  --accent-foreground: 0 0% 0%;
  --destructive: 0 70% 30%;
  --destructive-foreground: 0 0% 95%;
  --success: 120 70% 20%;
  --success-foreground: 120 90% 90%;
  --warning: 35 70% 20%;
  --warning-foreground: 35 90% 90%;
  --border: 0 0% 30%; /* Stark grey border */
  --input: 0 0% 10%;
  --ring: 0 0% 100%;
  --radius: 0px; /* Zero rounded corners for rigorous 80s/90s hardware authenticity */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --font-sans: "Courier New", Courier, "Lucida Console", "Liberation Mono", monospace;
}

/* Green Phosphor CRT Terminal Mode */
body.green-mode {
  --background: 120 40% 1%;
  --foreground: 120 85% 65%;
  --card: 120 30% 2%;
  --card-foreground: 120 85% 65%;
  --popover: 120 30% 2%;
  --popover-foreground: 120 85% 70%;
  --primary: 120 90% 50%;
  --primary-foreground: 120 40% 0%;
  --secondary: 120 30% 5%;
  --secondary-foreground: 120 80% 60%;
  --muted: 120 30% 3%;
  --muted-foreground: 120 60% 35%;
  --border: 120 60% 18%;
  --input: 120 60% 10%;
  --ring: 120 90% 50%;
}

/* Amber Phosphor CRT Terminal Mode */
body.amber-mode {
  --background: 30 45% 1%;
  --foreground: 30 90% 60%;
  --card: 30 30% 2%;
  --card-foreground: 30 90% 60%;
  --popover: 30 30% 2%;
  --popover-foreground: 30 90% 70%;
  --primary: 30 95% 50%;
  --primary-foreground: 30 35% 0%;
  --secondary: 30 30% 5%;
  --secondary-foreground: 30 80% 55%;
  --muted: 30 30% 3%;
  --muted-foreground: 30 65% 30%;
  --border: 30 65% 18%;
  --input: 30 60% 10%;
  --ring: 30 95% 50%;
}

/* Classic Telecom Beige Workstation Theme */
body.beige-mode {
  --background: 35 15% 75%; /* Soft PC Beige plastic */
  --foreground: 40 10% 10%; /* Dark Charcoal */
  --card: 35 10% 82%; /* Off-white plastic */
  --card-foreground: 40 10% 10%;
  --popover: 35 10% 85%;
  --popover-foreground: 40 10% 10%;
  --primary: 40 10% 10%; /* Black core text */
  --primary-foreground: 35 15% 90%;
  --secondary: 35 10% 68%; /* Medium beige */
  --secondary-foreground: 40 10% 10%;
  --muted: 35 10% 74%;
  --muted-foreground: 40 10% 35%;
  --border: 35 15% 40%; /* Darker beige edge */
  --input: 35 15% 55%;
  --ring: 40 10% 10%;
}

* {
  box-sizing: border-box;
  border-radius: 0px !important; /* Forces strict, blocky retro layout across entire workspace */
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  transition: background 0.15s, color 0.15s;
  image-rendering: pixelated;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: var(--font-sans) !important;
  font-size: 11px;
}

/* Clean Terminal Elements Style Overrides */
body, button, input, select, textarea {
  font-family: "Courier New", Courier, "Lucida Console", monospace !important;
}

/* Force stark terminal panels, inputs, and buttons */
.panel, .mini-card, .record-card, .controls-container, .speech-row, .topbar {
  background-color: hsl(var(--card)) !important;
  border: 1px solid hsl(var(--border)) !important;
  box-shadow: none !important;
}

input, select, textarea {
  background-color: #000000 !important;
  border: 1px solid hsl(var(--border)) !important;
  color: hsl(var(--foreground)) !important;
}

/* Theme adaptation for text */
.text-slate-400, .text-slate-500, .text-zinc-400, .text-zinc-500, .text-slate-300 {
  color: hsl(var(--muted-foreground)) !important;
}
.text-white, .text-slate-100 {
  color: hsl(var(--foreground)) !important;
}

/* Button adaptation */
.btn {
  border: 1px solid hsl(var(--border)) !important;
  background-color: hsl(var(--secondary)) !important;
  color: hsl(var(--secondary-foreground)) !important;
}
.btn:hover:not(:disabled) {
  background-color: hsl(var(--foreground)) !important;
  color: hsl(var(--background)) !important;
}
.btn.primary {
  background-color: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

.topbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px 8px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 2px solid hsl(var(--border));
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  gap: 12px;
}

.panel {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 2px solid hsl(var(--border));
  padding: 12px;
  position: relative;
}

/* Tab Implementation */
.tab-nav {
  display: flex;
  overflow-x: auto;
}
.tab-btn {
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  padding: 6px 12px;
}
.tab-btn.active {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border)) hsl(var(--border)) hsl(var(--background));
  background: hsl(var(--card));
  font-weight: bold;
}
.tab-btn:not(.active):hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.tab-panel.hidden-panel {
  display: none !important;
}
.tab-panel.active-panel {
  display: block !important;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.console-grid {
  display: grid;
  gap: 12px;
}

/* Authentic CRT Retro Terminal Monitor */
.screen {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 2px solid hsl(var(--border));
  background: #000000;
  color: hsl(var(--foreground));
  padding: 12px;
  box-shadow: none;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
  background-size: 100% 4px;
  z-index: 2;
  opacity: 0.4;
}

/* Glass CRT curvature vignette */
.screen::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: radial-gradient(circle, rgba(0,0,0,0) 65%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Subtle outer CRT screen glow */
body.green-mode .screen {
  box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.15);
  text-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
body.amber-mode .screen {
  box-shadow: inset 0 0 30px rgba(245, 158, 11, 0.15);
  text-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
}
body.beige-mode .screen {
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2);
  text-shadow: none;
}
body:not(.green-mode):not(.amber-mode):not(.beige-mode) .screen {
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* CRT Screen Flicker animation */
.screen.crt-flicker {
  animation: crtGlitch 0.25s infinite;
}
@keyframes crtGlitch {
  0% { opacity: 0.97; }
  50% { opacity: 1.0; }
  100% { opacity: 0.98; }
}

.screen-title {
  position: relative;
  font-size: 10px;
  font-weight: bold;
  border-bottom: 1px solid hsl(var(--border));
  padding-bottom: 3px;
  margin-bottom: 6px;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.call-display {
  display: grid;
  gap: 1px;
}
.call-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dotted hsl(var(--border));
  padding-bottom: 1px;
  font-size: 11px;
}
.call-row span {
  color: hsl(var(--muted-foreground));
}

.transcript {
  height: 200px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid hsl(var(--border));
  background: #000000;
  font-size: 11px;
  margin-top: 6px;
}
.line {
  margin: 0 0 3px;
  line-height: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 1px;
}

/* Dialogue colors for high clarity and restraint */
.line.operator { color: hsl(var(--foreground)); font-weight: bold; }
.line.customer { color: hsl(var(--foreground)); opacity: 0.85; }
.line.system { color: hsl(var(--muted-foreground)); }

/* Quick Response Dialogue Box */
.dialogue-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.quick-phrase-btn {
  background: transparent;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  padding: 4px 8px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.1s;
}
.quick-phrase-btn:hover {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.blink {
  animation: blink 0.8s steps(2, start) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.side-stack {
  display: grid;
  gap: 12px;
}
.mini-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 10px;
  display: grid;
  gap: 6px;
}
.big-number {
  font-size: 22px;
  line-height: 26px;
  font-weight: 700;
}
.queue-list {
  display: grid;
  gap: 3px;
}
.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  font-size: 10px;
}

/* Switchboard Line Selectors */
.line-selector-btn {
  transition: all 0.15s;
  border: 1px solid hsl(var(--border));
}
.line-selector-btn.active {
  border-color: hsl(var(--foreground)) !important;
  background: hsl(var(--muted));
}

.lamp {
  min-width: 90px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid hsl(var(--border));
  background: #000;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
}
.lamp.ringing {
  background: #7c2d12 !important;
  color: #ffedd5 !important;
  border-color: #f97316 !important;
  animation: lampBlink 0.5s infinite;
}
.lamp.active {
  background: #14532d !important;
  color: #dcfce7 !important;
  border-color: #22c55e !important;
}

@keyframes lampBlink {
  50% { background: #9a3412 !important; }
}

.controls, .speech-row {
  display: grid;
  gap: 4px;
}
.btn {
  min-height: 32px;
  border: 1px solid hsl(var(--border));
  padding: 4px 8px;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  cursor: pointer;
  transition: all 0.1s;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.btn:hover:not(:disabled) {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}
.btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
}
.btn.primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn.success {
  border-color: #166534 !important;
  color: #4ade80 !important;
}
.btn.warning {
  border-color: #b45309 !important;
  color: #fbbf24 !important;
}
.btn.danger {
  border-color: #b91c1c !important;
  color: #f87171 !important;
}

.field {
  min-height: 32px;
  width: 100%;
  border: 1px solid hsl(var(--border)) !important;
  padding: 4px 6px;
  background: #000000 !important;
  color: hsl(var(--foreground)) !important;
  font-size: 11px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.stat {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  text-align: center;
  padding: 6px;
}
.stat .value {
  display: block;
  font-size: 15px;
  font-weight: 700;
}
.stat .label {
  color: hsl(var(--muted-foreground));
  font-size: 9px;
  text-transform: uppercase;
}

.career-file, .messages {
  display: grid;
  gap: 6px;
}
.badge {
  display: inline-flex;
  padding: 1px 6px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 10px;
  font-weight: 700;
}
.record-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 8px;
}
.record-card p {
  margin: 2px 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 10px;
}

.report-box {
  white-space: pre-wrap;
  min-height: 120px;
  overflow-y: auto;
  margin: 0;
  background: #000000;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  padding: 8px;
  font-size: 10px;
}

/* Toast alert styling */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 100;
  padding: 12px 20px;
  border: 1px solid hsl(var(--foreground));
  background: #000000;
  color: hsl(var(--foreground));
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
  display: none;
}
.toast.show {
  display: block;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: hsl(var(--border));
}
.bottom-nav button {
  min-height: 38px;
  border: 0;
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  font-size: 10px;
  font-weight: 700;
}
.bottom-nav button.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

@media (min-width: 640px) {
  .controls { grid-template-columns: repeat(4, 1fr); }
  .speech-row { grid-template-columns: 140px 1fr 100px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  body { padding-bottom: 24px; }
  .console-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .controls { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(8, 1fr); }
  .bottom-nav { display: none; }
}
