/* ===== Base Styles ===== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* ===== Layout Structure ===== */
.main-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 20px auto;
  max-width: 1200px;
  gap: 20px;
}

.led-section, .sensor-section {
  flex: 1;
  min-width: 300px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.code-container {
  width: 100%;
  margin-top: 20px;
}

/* ===== LED Matrix Styles ===== */
#ledMatrix {
  display: grid;
  grid-template-columns: repeat(5, 50px);
  grid-gap: 10px;
  justify-content: center;
  margin: 20px auto;
  padding: 15px;
  background-color: #f0f0f0;
  border-radius: 8px;
}

.led {
  width: 50px;
  height: 50px;
  background-color: #ccc;
  border-radius: 5px;
  box-shadow: 0 0 10px #999;
  transition: all 0.3s;
}

/* ===== Sensor Styles ===== */
.sensor-value {
  font-weight: bold;
  color: #2c3e50;
  font-size: 1.1em;
}

#sensorScreen {
  margin-top: 15px;
  padding: 10px;
  width: 100%;
  height: 150px;
  background: #000;
  color: #0f0;
  font-family: monospace;
  overflow-y: auto;
  border: 2px solid #0f0;
  border-radius: 5px;
}

/* ===== Code Editor Styles ===== */
#codeEditor {
  width: 100%;
  height: 150px;
  padding: 15px;
  font-family: monospace;
  border: 1px solid #ddd;
  border-radius: 5px;
  resize: vertical;
  box-sizing: border-box;
}

/* ===== Button Styles ===== */
button {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  transition: all 0.3s;
}

#runButton {
  background-color: #28a745;
  color: white;
  margin-top: 10px;
}

#runButton:hover {
  background-color: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* ===== Typography & Utilities ===== */
h2 {
  color: #2c3e50;
  text-align: center;
  margin-bottom: 20px;
}

h3 {
  color: #2c3e50;
  margin-top: 0;
}

.instructions {
  font-size: 14px;
  color: #555;
  text-align: center;
  margin-bottom: 20px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Animation Classes ===== */
/* These will be applied dynamically by JavaScript */
.led.on {
  background-color: red;
  box-shadow: 0 0 20px red;
}

.led.pulse {
  animation: pulse 1s infinite;
}

.led.fade {
  animation: fade 2s infinite;
}

.led.rainbow {
  animation: rainbow 3s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes rainbow {
  0% { background-color: red; }
  14% { background-color: orange; }
  28% { background-color: yellow; }
  42% { background-color: green; }
  57% { background-color: blue; }
  71% { background-color: indigo; }
  85% { background-color: violet; }
  100% { background-color: red; }
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    align-items: center;
  }
  
  .led-section, .sensor-section {
    width: 100%;
    max-width: none;
  }
  
  #ledMatrix {
    grid-template-columns: repeat(5, 40px);
  }
  
  .led {
    width: 40px;
    height: 40px;
  }
}
.sensor-section div {
  margin: 5px 0;
  font-family: monospace;
}
.sensor-value {
  font-weight: bold;
  color: #0f0;
}
:root {
    --primary: #3f51b5;
    --primary-dark: #303f9f;
    --primary-light: #c5cae9;
    --secondary: #ff9800;
    --accent: #4caf50;
    --text: #212121;
    --text-light: #757575;
    --background: #f5f5f5;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
}

header {
    background-color: var(--primary);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

nav {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: var(--primary-dark);
}

.lab-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toolbox, .chemical-selector, .experiment-selector {
    background: var(--primary-light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.gate, .chemical {
    background: white;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.gate:hover, .chemical:hover {
    transform: translateY(-2px);
}

.workspace, .physics-workspace, .chemistry-workspace {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.controls, .physics-controls, .chemistry-controls {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--primary-dark);
}

.beaker {
    width: 200px;
    height: 300px;
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 0 0 20px 20px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0;
    transition: height 0.5s, background-color 0.5s;
}

.reaction-result {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #e8f5e9;
    border-radius: 4px;
}