/* Audio Digit Recognition System - Pixel Art UI */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Root Variables - Inspired by the pixel art design */
:root {
  /* Color palette from the image */
  --bg-primary: #f8f8f0;        /* Off-white background */
  --text-primary: #2c2c2c;      /* Dark gray text */
  --text-secondary: #666666;    /* Medium gray text */
  --accent-yellow: #ffd700;     /* Golden yellow for highlights */
  --accent-red: #ff4444;        /* Red for hearts/active elements */
  --button-light: #e8e8e8;      /* Light button background */
  --button-dark: #4a4a4a;       /* Dark button background */
  --button-selected: #333333;   /* Selected button state */
  --green-screen: #00ff00;      /* Terminal green */
  --green-dark: #008800;        /* Darker green */
  --border-color: #cccccc;      /* Light border */
  
  /* Pixel art styling */
  --pixel-size: 2px;
  --border-width: 2px;
  --shadow-offset: 3px;
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  
  /* Animations */
  --glow-animation: pixel-glow 0.8s ease-in-out;
  --pulse-animation: pixel-pulse 1.5s ease-in-out infinite;
}

/* Pixel art rendering */
* {
  box-sizing: border-box;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Base Styles */
body {
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
}

/* Add pixel art background decorations */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    /* Clouds in corners */
    radial-gradient(ellipse 60px 30px at 80px 60px, rgba(200,200,200,0.3) 40%, transparent 70%),
    radial-gradient(ellipse 80px 40px at 150px 80px, rgba(200,200,200,0.2) 40%, transparent 70%),
    radial-gradient(ellipse 70px 35px at calc(100% - 120px) 70px, rgba(200,200,200,0.3) 40%, transparent 70%),
    radial-gradient(ellipse 90px 45px at calc(100% - 80px) 90px, rgba(200,200,200,0.2) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 25px;
  background: rgba(255, 255, 255, 0.8);
  border: var(--border-width) solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 rgba(0, 0, 0, 0.1);
}

.title {
  font-size: 18px;
  color: var(--text-primary);
  text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
  margin: 0 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.subtitle {
  font-size: 9px;
  color: var(--text-secondary);
  margin: 0 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}


/* Collapsible How-to Section */
.collapsible-section {
  margin-bottom: 25px;
}

.collapsible-header {
  background: var(--button-light);
  border: var(--border-width) solid var(--border-color);
  border-radius: 6px;
  padding: 12px 20px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapsible-header:hover {
  background: var(--button-dark);
  color: white;
}

.collapsible-toggle {
  font-size: 8px;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.collapsible-header.active .collapsible-toggle {
  transform: rotate(90deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(255, 255, 255, 0.5);
  border: var(--border-width) solid var(--border-color);
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.collapsible-content.active {
  max-height: 300px;
  padding: 15px 20px;
}

/* Audio Input Monitor */
.audio-section {
  background: rgba(0, 0, 0, 0.9);
  border: var(--border-width) solid var(--green-dark);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  position: relative;
}

.audio-section .cabinet-title {
  color: var(--green-screen);
  text-shadow: 0 0 5px var(--green-screen);
  margin-bottom: 15px;
}

.visualizer-screen {
  background: #000;
  border: var(--border-width) solid var(--green-dark);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 15px;
  box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.2);
  position: relative;
}

/* Real-time prediction box positioned on the right side of the visualizer */
.realtime-prediction-box {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 190px;
  height: 190px;
  background: #000;
  border: 4px solid #ffd700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 0 20px rgba(255, 215, 0, 0.5),
    inset 0 0 15px rgba(255, 215, 0, 0.15);
  z-index: 10;
}

.realtime-prediction-box span {
  font-family: var(--font-pixel);
  font-size: 60px;
  color: #ffd700;
  text-shadow: 
    0 0 16px #ffd700,
    0 0 32px #ffd700;
  font-weight: bold;
  text-align: center;
  transition: all 0.3s ease-in-out;
}

.visualizer-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Performance Star Icon */
.performance-star {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 25px;
  height: 25px;
  z-index: 5;
  opacity: 0.9;
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
  transition: all 0.3s ease;
}

.performance-star:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

/* Footer Banner */
.footer-banner {
  margin-top: 40px;
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
}

.footer-image {
  max-width: 100%;
  height: auto;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.footer-image:hover {
  opacity: 1;
}

/* System Specifications Bar */
.system-specs-section {
  margin: 20px 0;
}

.system-specs-bar {
  background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
  border: 2px solid #444;
  border-radius: 6px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.specs-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #ffd700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
  min-width: 80px;
}

.specs-details {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: #e0e0e0;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

/* Robustness Toggle Button */
.robustness-toggle {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-pixel);
  text-transform: uppercase;
}

.robustness-toggle:hover {
  background: var(--button-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 rgba(0, 0, 0, 0.1);
}

/* Robustness Popup */
.robustness-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid var(--button-dark);
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 350px;
  display: none;
}

.robustness-popup.active {
  display: block;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.popup-overlay.active {
  display: block;
}

/* Processing Methods Grid */
.methods-grid {
  margin-bottom: 30px;
}

.section-header {
  font-size: 14px;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
}

.methods-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}

.section-header {
  grid-column: 1 / -1; /* Span all columns */
}

@media (max-width: 1400px) {
  .methods-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
}

@media (max-width: 1000px) {
  .methods-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

@media (max-width: 600px) {
  .methods-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

.method-cabinet {
  background: var(--button-light);
  border: var(--border-width) solid var(--border-color);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

.method-cabinet:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-offset) calc(var(--shadow-offset) + 2px) 0 rgba(0, 0, 0, 0.1);
}

.method-cabinet.selected {
  background: var(--button-selected);
  color: white;
  border-color: var(--accent-yellow);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.method-header {
  padding: 15px;
  text-align: center;
  border-bottom: var(--border-width) solid var(--border-color);
}

.method-cabinet.selected .method-header {
  border-bottom-color: var(--accent-yellow);
}

.method-title {
  font-size: 9px;
  margin: 0 0 5px 0;
  text-transform: uppercase;
}

.method-subtitle {
  font-size: 7px;
  opacity: 0.7;
  margin: 0;
}

/* Prediction Box */
.prediction-box {
  padding: 15px;
  background: rgba(0, 0, 0, 0.05);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.method-cabinet.selected .prediction-box {
  background: rgba(255, 255, 255, 0.1);
}

.prediction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
}

.prediction-value {
  font-weight: bold;
  color: var(--accent-yellow);
  font-size: 11px;
}

.method-cabinet:not(.selected) .prediction-value {
  color: var(--text-secondary);
}

/* Pixel Glow Animation */
@keyframes pixel-glow {
  0% {
    box-shadow: 0 0 5px var(--accent-yellow);
    transform: scale(1);
  }
  25% {
    box-shadow: 
      0 0 10px var(--accent-yellow),
      0 0 20px var(--accent-yellow),
      inset 0 0 5px rgba(255, 215, 0, 0.1);
    transform: scale(1.02);
  }
  50% {
    box-shadow: 
      0 0 15px var(--accent-yellow),
      0 0 30px var(--accent-yellow),
      0 0 40px rgba(255, 215, 0, 0.3),
      inset 0 0 10px rgba(255, 215, 0, 0.2);
    transform: scale(1.05);
  }
  75% {
    box-shadow: 
      0 0 10px var(--accent-yellow),
      0 0 20px var(--accent-yellow),
      inset 0 0 5px rgba(255, 215, 0, 0.1);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 5px var(--accent-yellow);
    transform: scale(1);
  }
}

.prediction-glow {
  animation: var(--glow-animation);
  border-color: var(--accent-yellow) !important;
  position: relative;
  z-index: 10;
}

/* Enhanced glow for prediction values */
.method-cabinet.prediction-glow .prediction-value {
  color: var(--accent-yellow) !important;
  text-shadow: 
    0 0 5px var(--accent-yellow),
    0 0 10px var(--accent-yellow),
    0 0 15px rgba(255, 215, 0, 0.5);
  animation: text-glow 0.8s ease-in-out;
}

@keyframes text-glow {
  0%, 100% {
    text-shadow: 
      0 0 5px var(--accent-yellow),
      0 0 10px var(--accent-yellow);
  }
  50% {
    text-shadow: 
      0 0 10px var(--accent-yellow),
      0 0 20px var(--accent-yellow),
      0 0 30px var(--accent-yellow);
  }
}

/* Buttons */
.btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 10px 15px;
  border: var(--border-width) solid var(--border-color);
  background: var(--button-light);
  color: var(--text-primary);
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--button-dark);
  color: white;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-success {
  background: var(--green-dark);
  color: white;
  border-color: var(--green-screen);
}

.btn-success:hover {
  background: var(--green-screen);
  color: black;
  box-shadow: 0 0 10px var(--green-screen);
}

.btn-danger {
  background: var(--accent-red);
  color: white;
  border-color: darkred;
}

.btn-info {
  background: #4a90e2;
  color: white;
  border-color: #357abd;
}

/* Architecture Section */
.architecture-section {
  background: rgba(255, 255, 255, 0.8);
  border: var(--border-width) solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-top: 30px;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.architecture-card {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 15px;
}

.architecture-title {
  font-size: 11px;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.metrics-table {
  font-size: 8px;
  width: 100%;
  border-collapse: collapse;
}

.metrics-table th,
.metrics-table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.metrics-table th {
  background: rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
}

/* Status indicators */
.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.status-indicator.ready {
  background: var(--green-screen);
  box-shadow: 0 0 5px var(--green-screen);
}

.status-indicator.working {
  background: var(--accent-yellow);
  animation: var(--pulse-animation);
}

.status-indicator.error {
  background: var(--accent-red);
}

/* Pulse animation */
@keyframes pixel-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .methods-grid {
    grid-template-columns: 1fr;
  }
  
  .visualizer-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .robustness-toggle {
    position: static;
    margin-top: 15px;
    align-self: flex-end;
  }
}

/* Hide elements that will be removed */
.legacy-section,
.log-section,
.stats-section {
  display: none;
}