/* Titration Lab Specific Styles */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.concentration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .concentration-grid {
    grid-template-columns: 1fr;
  }
}

.titration-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 12px;
}

.stat-label {
  color: #6c757d;
  font-weight: 500;
}

.stat-value {
  font-family: monospace;
  color: #2c3e50;
  font-weight: 600;
}

.titration-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speed-controls {
  display: flex;
  gap: 4px;
}

.speed-btn {
  flex: 1;
  padding: 6px 8px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.speed-btn:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.speed-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: #667eea;
}

.btn-large {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
}

.manual-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.manual-add .input-field {
  flex: 1;
}

.indicator-display {
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.indicator-label {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 8px;
}

.color-indicator {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 8px;
  border: 3px solid #dee2e6;
  background: #ffffff;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.color-description {
  font-size: 11px;
  color: #495057;
  font-weight: 500;
}

.chart-container {
  position: relative;
  background: #ffffff;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

#titrationChart {
  display: block;
  width: 100%;
  height: 400px;
  background: 
    linear-gradient(to right, #f8f9fa 0%, #f8f9fa 1px, transparent 1px),
    linear-gradient(to bottom, #f8f9fa 0%, #f8f9fa 1px, transparent 1px);
  background-size: 40px 40px;
}

.chart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.chart-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
}

.data-table-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #dee2e6;
  font-family: monospace;
}

.data-table tbody tr:hover {
  background: rgba(102, 126, 234, 0.1);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(248, 249, 250, 0.5);
}

.equivalence-point {
  background: rgba(40, 167, 69, 0.2) !important;
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* 指示剂颜色 */
.color-indicator.phenolphthalein-acidic {
  background: #ffffff;
}

.color-indicator.phenolphthalein-basic {
  background: #ff69b4;
}

.color-indicator.methyl-orange-acidic {
  background: #ff4500;
}

.color-indicator.methyl-orange-neutral {
  background: #ffa500;
}

.color-indicator.methyl-orange-basic {
  background: #ffff00;
}

.color-indicator.bromothymol-blue-acidic {
  background: #ffff00;
}

.color-indicator.bromothymol-blue-neutral {
  background: #90ee90;
}

.color-indicator.bromothymol-blue-basic {
  background: #0000ff;
}

.color-indicator.universal {
  background: linear-gradient(45deg, 
    #ff0000 0%, #ff8000 14%, #ffff00 28%, 
    #80ff00 42%, #00ff00 57%, #00ff80 71%, 
    #0080ff 85%, #0000ff 100%);
}

/* pH值颜色编码 */
.ph-very-acidic { color: #dc3545; font-weight: 600; }
.ph-acidic { color: #fd7e14; font-weight: 600; }
.ph-neutral { color: #28a745; font-weight: 600; }
.ph-basic { color: #007bff; font-weight: 600; }
.ph-very-basic { color: #6f42c1; font-weight: 600; }

/* 动画效果 */
.stat-item.updated {
  animation: statUpdate 0.5s ease-out;
}

@keyframes statUpdate {
  0% {
    background: rgba(40, 167, 69, 0.2);
    transform: scale(1.02);
  }
  100% {
    background: rgba(255,255,255,0.8);
    transform: scale(1);
  }
}

.color-indicator.changing {
  animation: colorChange 0.8s ease-in-out;
}

@keyframes colorChange {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(102, 126, 234, 0.5); }
}

.equivalence-point-marker {
  animation: equivalenceGlow 1s ease-in-out infinite alternate;
}

@keyframes equivalenceGlow {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .titration-stats {
    grid-template-columns: 1fr;
  }
  
  .speed-controls {
    flex-direction: column;
  }
  
  .manual-add {
    flex-direction: column;
    align-items: stretch;
  }
  
  .chart-controls {
    justify-content: center;
  }
  
  .toolbar {
    justify-content: center;
  }
  
  #titrationChart {
    height: 300px;
  }
  
  .data-table {
    font-size: 11px;
  }
  
  .data-table th,
  .data-table td {
    padding: 4px 6px;
  }
}

@media (max-width: 480px) {
  .concentration-grid {
    grid-template-columns: 1fr;
  }
  
  .indicator-display {
    padding: 8px;
  }
  
  .color-indicator {
    width: 40px;
    height: 40px;
  }
}