/* ==========================================================================
   4-Bit PIPO Shift Register - Professional CSS Design System
   Digital Electronics Virtual Laboratory
   ========================================================================== */

:root {
  /* Core Color Palette */
  --bg-dark: #090d16;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(51, 65, 85, 0.6);
  --border-glow: rgba(0, 240, 255, 0.3);

  --primary-cyan: #00f0ff;
  --primary-blue: #3b82f6;
  --accent-purple: #a855f7;
  --status-green: #10b981;
  --status-amber: #f59e0b;
  --status-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.15);
  --shadow-amber-glow: 0 0 20px rgba(245, 158, 11, 0.25);
  --shadow-purple-glow: 0 0 20px rgba(168, 85, 247, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Reset & Global Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: none !important;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Card Component (Glassmorphism) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header h2,
.card-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h2 svg,
.card-header h3 svg {
  color: var(--primary-cyan);
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.cyan {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.badge.purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.mono-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.lab-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-cyan);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-summary-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

.status-dot.amber {
  background-color: var(--status-amber);
  box-shadow: 0 0 10px var(--status-amber);
  animation: pulse-dot 0.8s infinite alternate;
}

@keyframes pulse-dot {
  from {
    opacity: 0.5;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1.2);
  }
}

.status-text {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Toolbar Controls */
.toolbar-section {
  padding: 1rem 1.25rem;
}

.toolbar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-load {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-load:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399, #059669);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue), #2563eb);
  color: #fff;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, var(--primary-blue));
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(51, 65, 85, 0.7);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(71, 85, 105, 0.9);
}

.btn-accent {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--primary-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-text-action:hover {
  background: rgba(0, 240, 255, 0.1);
  text-decoration: underline;
}

.sliders-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.slider-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 180px;
}

.select-control {
  background: #0f172a;
  color: var(--primary-cyan);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-control:hover,
.select-control:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-cyan);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Banner Section (Displays & Parallel Inputs) */
.banner-section {
  display: grid;
  grid-template-columns: 1.8fr 2.2fr 1fr 1fr 1.5fr;
  gap: 1rem;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.display-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Parallel Input Toggles */
.input-display-card {
  display: flex;
  flex-direction: column;
}

.input-toggles-wrapper {
  display: flex;
  gap: 0.5rem;
}

.input-bit-box {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.input-bit-box.high {
  border-color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.bit-tag {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
}

.bit-toggle-btn {
  width: 100%;
  padding: 0.3rem 0;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  background: #1e293b;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bit-toggle-btn:hover {
  background: #334155;
  color: #fff;
}

.input-bit-box.high .bit-toggle-btn {
  background: rgba(0, 240, 255, 0.2);
  color: var(--primary-cyan);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.bit-status-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
}

.input-bit-box.high .bit-status-label {
  color: var(--primary-cyan);
}

/* Parallel Output Display Boxes & LEDs */
.binary-display-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.bit-box {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.25rem;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bit-box.high {
  border-color: var(--status-green);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.bit-box.loading-active {
  border-color: var(--status-amber);
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
  animation: pulse-bit 0.3s ease infinite alternate;
}

@keyframes pulse-bit {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-3px);
  }
}

.bit-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
}

.bit-val {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
}

.bit-box.high .bit-val {
  color: var(--status-green);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.led-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
  margin-top: 0.2rem;
  transition: all 0.2s ease;
}

.bit-box.high .led-indicator {
  background: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

/* Values & Large Display */
.val-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.large-val {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--primary-blue);
  text-align: center;
}

.large-val.hex-val {
  color: var(--accent-purple);
}

.val-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.ripple-state-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-indicator-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  text-align: center;
  transition: all 0.2s ease;
}

.status-indicator-box.loading {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: var(--shadow-amber-glow);
}

.status-indicator-box.pulsing {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: var(--shadow-glow);
}

.status-title {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.5px;
  color: var(--status-green);
}

.status-indicator-box.loading .status-title {
  color: var(--status-amber);
}

.status-indicator-box.pulsing .status-title {
  color: var(--primary-cyan);
}

.status-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 1.25rem;
}

/* Circuit Schematic Workspace */
.schematic-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.schematic-card {
  display: flex;
  flex-direction: column;
}

.circuit-container {
  position: relative;
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.circuit-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.color-dot.line-high {
  background-color: var(--primary-cyan);
  box-shadow: 0 0 6px var(--primary-cyan);
}

.color-dot.line-low {
  background-color: #475569;
}

.color-dot.line-active {
  background-color: var(--status-amber);
  box-shadow: 0 0 6px var(--status-amber);
}

.svg-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
}

#circuitSvg {
  display: block;
  min-width: 850px;
}

.schematic-footnote {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-cyan);
}

/* Waveform Canvas */
.waveform-card {
  display: flex;
  flex-direction: column;
}

.waveform-container {
  width: 100%;
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  overflow-x: auto;
}

#waveformCanvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Monitors Column */
.monitors-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.monitor-card {
  padding: 1rem;
}

.clock-probes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.probe-item {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: all 0.2s ease;
}

.probe-item.active-edge {
  border-color: var(--status-amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.probe-name {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
}

.probe-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.probe-badge.low {
  background: #1e293b;
  color: #64748b;
}

.probe-badge.high {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.probe-badge.rising {
  background: rgba(245, 158, 11, 0.25);
  color: var(--status-amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* State Summary Grid */
.state-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.state-item {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.state-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.state-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
}

.highlight-cyan {
  color: var(--primary-cyan);
}

.highlight-green {
  color: var(--status-green);
}

.highlight-purple {
  color: var(--accent-purple);
}

.state-transition-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 9, 17, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.trans-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.trans-box.active .trans-val {
  color: var(--primary-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.trans-title {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 600;
}

.trans-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.trans-arrow {
  color: var(--text-dim);
  font-weight: bold;
}

/* Parallel Output Monitor Details */
.output-monitor-details {
  display: flex;
  gap: 1rem;
}

.bit-output-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bit-line {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
}

.bit-name {
  color: var(--text-muted);
}

.bit-code {
  font-weight: bold;
  color: var(--status-green);
}

.output-conversions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.conv-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
}

.conv-val {
  font-family: var(--font-mono);
  font-weight: bold;
  color: var(--primary-cyan);
}

/* Flip-Flop Status Cards Grid */
.ff-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.ff-status-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem;
  transition: all 0.2s ease;
}

.ff-status-card.active-latch {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.ff-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
}

.ff-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-cyan);
}

.ff-type {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.ff-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.text-cyan {
  color: var(--primary-cyan);
}

.status-pill-sm {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
}

/* History Log Table */
.log-table-wrapper {
  max-height: 180px;
  overflow-y: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.log-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: var(--text-muted);
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.log-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  color: var(--text-main);
}

.log-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Theory & Comparison Section */
.theory-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.comp-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.comp-card.highlighted-pipo {
  background: rgba(0, 240, 255, 0.06);
  border: 2px solid var(--primary-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.comp-header {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.comp-card.highlighted-pipo .comp-header {
  color: var(--primary-cyan);
}

.comp-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-blue);
}

.comp-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.comp-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  align-self: flex-start;
}

.comp-badge.active-cyan {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.theory-content-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.theory-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.theory-box h3 {
  font-size: 0.95rem;
  color: var(--primary-cyan);
  margin-bottom: 0.4rem;
}

.theory-box p,
.theory-box ul {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.theory-box ul {
  padding-left: 1.2rem;
}

.theory-box li {
  margin-bottom: 0.25rem;
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .banner-section {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .banner-section {
    grid-template-columns: 1fr 1fr;
  }

  .theory-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .banner-section {
    grid-template-columns: 1fr;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .input-toggles-wrapper,
  .binary-display-wrapper {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   LIGHT THEME DESIGN SYSTEM OVERRIDES (4-BIT PIPO SHIFT REGISTER)
   ========================================================================== */
[data-theme="light"],
html[data-theme="light"],
html:not(.dark) {
  --bg-dark: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --border-color: rgba(203, 213, 225, 0.8);
  --border-glow: rgba(2, 132, 199, 0.3);

  --primary-cyan: #0284c7;
  --primary-blue: #2563eb;
  --accent-purple: #9333ea;
  --status-green: #059669;
  --status-amber: #d97706;
  --status-red: #dc2626;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-sm: 0 4px 12px -2px rgba(0, 0, 0, 0.06);
}

/* Header Text Visibility */
[data-theme="light"] .app-header h1,
html[data-theme="light"] .app-header h1 {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

[data-theme="light"] .app-header .subtitle,
html[data-theme="light"] .app-header .subtitle {
  color: #475569 !important;
}

[data-theme="light"] .lab-badge,
html[data-theme="light"] .lab-badge {
  color: #0284c7 !important;
}

/* Status Summary Pill */
[data-theme="light"] .status-summary-pill,
html[data-theme="light"] .status-summary-pill {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(203, 213, 225, 0.8) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .status-text,
html[data-theme="light"] .status-text {
  color: #0f172a !important;
}

/* Controls, Select & Buttons */
[data-theme="light"] .btn-secondary,
html[data-theme="light"] .btn-secondary {
  background: #e2e8f0 !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .btn-secondary:hover:not(:disabled),
html[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  background: #cbd5e1 !important;
}

[data-theme="light"] .btn-danger,
html[data-theme="light"] .btn-danger {
  background: rgba(220, 38, 38, 0.1) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(220, 38, 38, 0.3) !important;
}

[data-theme="light"] .select-control,
html[data-theme="light"] .select-control {
  background: #ffffff !important;
  color: #0284c7 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] input[type="range"],
html[data-theme="light"] input[type="range"] {
  background: #cbd5e1 !important;
}

/* Parallel Input Setup & Bit Boxes */
[data-theme="light"] .input-bit-box,
html[data-theme="light"] .input-bit-box {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .input-bit-box.high,
html[data-theme="light"] .input-bit-box.high {
  background: rgba(2, 132, 199, 0.1) !important;
  border-color: #0284c7 !important;
}

[data-theme="light"] .bit-tag,
[data-theme="light"] .bit-status-label,
html[data-theme="light"] .bit-tag,
html[data-theme="light"] .bit-status-label {
  color: #64748b !important;
}

[data-theme="light"] .input-bit-box.high .bit-status-label,
html[data-theme="light"] .input-bit-box.high .bit-status-label {
  color: #0284c7 !important;
}

[data-theme="light"] .bit-toggle-btn,
html[data-theme="light"] .bit-toggle-btn {
  background: #ffffff !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .input-bit-box.high .bit-toggle-btn,
html[data-theme="light"] .input-bit-box.high .bit-toggle-btn {
  background: rgba(2, 132, 199, 0.15) !important;
  color: #0284c7 !important;
  border-color: #0284c7 !important;
}

/* Parallel Output Register Boxes & Indicators */
[data-theme="light"] .bit-box,
html[data-theme="light"] .bit-box {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .bit-box.high,
html[data-theme="light"] .bit-box.high {
  background: rgba(5, 150, 105, 0.1) !important;
  border-color: #059669 !important;
}

[data-theme="light"] .bit-label,
html[data-theme="light"] .bit-label {
  color: #64748b !important;
}

[data-theme="light"] .bit-val,
html[data-theme="light"] .bit-val {
  color: #0f172a !important;
}

[data-theme="light"] .bit-box.high .bit-val,
html[data-theme="light"] .bit-box.high .bit-val {
  color: #059669 !important;
  text-shadow: none !important;
}

[data-theme="light"] .led-indicator,
html[data-theme="light"] .led-indicator {
  background: #cbd5e1 !important;
}

[data-theme="light"] .large-val,
html[data-theme="light"] .large-val {
  color: #2563eb !important;
}

[data-theme="light"] .large-val.hex-val,
html[data-theme="light"] .large-val.hex-val {
  color: #9333ea !important;
}

[data-theme="light"] .val-sub,
html[data-theme="light"] .val-sub {
  color: #64748b !important;
}

[data-theme="light"] .status-indicator-box,
html[data-theme="light"] .status-indicator-box {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .status-title,
html[data-theme="light"] .status-title {
  color: #0f172a !important;
}

[data-theme="light"] .status-sub,
html[data-theme="light"] .status-sub {
  color: #475569 !important;
}

/* Schematic Area & Waveform Canvas & Footnote */
[data-theme="light"] .circuit-container,
[data-theme="light"] .waveform-container,
html[data-theme="light"] .circuit-container,
html[data-theme="light"] .waveform-container {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .schematic-footnote,
html[data-theme="light"] .schematic-footnote {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

[data-theme="light"] #circuitSvg,
html[data-theme="light"] #circuitSvg {
  background: #ffffff !important;
}

[data-theme="light"] #circuitSvg rect,
html[data-theme="light"] #circuitSvg rect {
  fill: #ffffff;
  stroke: #0284c7;
}

[data-theme="light"] #circuitSvg rect[fill="rgba(15,23,42,0.8)"],
html[data-theme="light"] #circuitSvg rect[fill="rgba(15,23,42,0.8)"] {
  fill: #f1f5f9 !important;
  stroke: #cbd5e1 !important;
}

[data-theme="light"] #circuitSvg rect[fill="rgba(6,9,17,0.8)"],
html[data-theme="light"] #circuitSvg rect[fill="rgba(6,9,17,0.8)"] {
  fill: #e0f2fe !important;
  stroke: #0284c7 !important;
}

[data-theme="light"] #circuitSvg text,
html[data-theme="light"] #circuitSvg text {
  fill: #0f172a !important;
}

[data-theme="light"] #circuitSvg text[fill="#f8fafc"],
html[data-theme="light"] #circuitSvg text[fill="#f8fafc"] {
  fill: #0284c7 !important;
  font-weight: 800 !important;
}

[data-theme="light"] #circuitSvg text[fill="#00f0ff"],
html[data-theme="light"] #circuitSvg text[fill="#00f0ff"] {
  fill: #0284c7 !important;
  font-weight: 700 !important;
}

[data-theme="light"] #circuitSvg text[fill="#10b981"],
html[data-theme="light"] #circuitSvg text[fill="#10b981"] {
  fill: #059669 !important;
  font-weight: 700 !important;
}

[data-theme="light"] #circuitSvg text[fill="#94a3b8"],
[data-theme="light"] #circuitSvg text[fill="#64748b"],
html[data-theme="light"] #circuitSvg text[fill="#94a3b8"],
html[data-theme="light"] #circuitSvg text[fill="#64748b"] {
  fill: #64748b !important;
}

/* Probes, State Items, Monitors, FF Cards */
[data-theme="light"] .probe-item,
[data-theme="light"] .state-item,
[data-theme="light"] .state-transition-row,
[data-theme="light"] .bit-line,
[data-theme="light"] .conv-box,
[data-theme="light"] .ff-status-card,
html[data-theme="light"] .probe-item,
html[data-theme="light"] .state-item,
html[data-theme="light"] .state-transition-row,
html[data-theme="light"] .bit-line,
html[data-theme="light"] .conv-box,
html[data-theme="light"] .ff-status-card {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .probe-name,
[data-theme="light"] .state-label,
[data-theme="light"] .trans-title,
[data-theme="light"] .bit-name,
[data-theme="light"] .conv-label,
[data-theme="light"] .metric-row,
html[data-theme="light"] .probe-name,
html[data-theme="light"] .state-label,
html[data-theme="light"] .trans-title,
html[data-theme="light"] .bit-name,
html[data-theme="light"] .conv-label,
html[data-theme="light"] .metric-row {
  color: #475569 !important;
}

[data-theme="light"] .probe-badge.low,
html[data-theme="light"] .probe-badge.low {
  background: #e2e8f0 !important;
  color: #475569 !important;
}

[data-theme="light"] .trans-val,
[data-theme="light"] .metric-row strong,
html[data-theme="light"] .trans-val,
html[data-theme="light"] .metric-row strong {
  color: #0f172a !important;
}

[data-theme="light"] .ff-title,
html[data-theme="light"] .ff-title {
  color: #0284c7 !important;
}

[data-theme="light"] .ff-card-header,
html[data-theme="light"] .ff-card-header {
  border-bottom-color: #cbd5e1 !important;
}

/* Log Table */
[data-theme="light"] .log-table th,
html[data-theme="light"] .log-table th {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
  border-bottom-color: #cbd5e1 !important;
}

[data-theme="light"] .log-table td,
html[data-theme="light"] .log-table td {
  border-bottom-color: #e2e8f0 !important;
  color: #334155 !important;
}

/* Theory & Comparison Section */
[data-theme="light"] .comp-card,
[data-theme="light"] .theory-box,
html[data-theme="light"] .comp-card,
html[data-theme="light"] .theory-box {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .comp-header,
html[data-theme="light"] .comp-header {
  color: #0f172a !important;
}

[data-theme="light"] .comp-card.highlighted-pipo,
html[data-theme="light"] .comp-card.highlighted-pipo {
  background: rgba(2, 132, 199, 0.08) !important;
  border-color: #0284c7 !important;
}

[data-theme="light"] .comp-desc,
[data-theme="light"] .theory-box p,
[data-theme="light"] .theory-box ul,
[data-theme="light"] .theory-box li,
html[data-theme="light"] .comp-desc,
html[data-theme="light"] .theory-box p,
html[data-theme="light"] .theory-box ul,
html[data-theme="light"] .theory-box li {
  color: #334155 !important;
}