/* Interactive Mode Styles for DFA Minimization */

.interactive-controls {
  background: white;
  border-radius: 8px;
  margin: 8px 0;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.current-step-info {
  background: #f5f7fa;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.current-string {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  margin-bottom: 3px;
}

.direction-text {
  color: #3B82F6;
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.instruction-text {
  color: #1e293b;
  font-size: 0.85rem;
}

.rule-selection-container {
  margin-bottom: 8px;
}

.rule-selection-container .instruction-text {
  margin-bottom: 8px;
  font-weight: 500;
  color: #1e293b;
  font-size: 0.9rem;
}

.rule-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.rule-button {
  background: #6366F1;
  color: #fff;
  border: none;
  box-shadow: 0 0.125rem 0.5rem rgba(59, 130, 246, 0.06);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 1rem;
  font-family: 'Inter', system-ui, sans-serif;
  padding: 0.75rem 1.5rem;
  min-width: 110px;
  min-height: 2.5rem;
  border-radius: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.01em;
  margin-bottom: 5px;
}

.rule-button:hover {
  filter: brightness(0.95);
  box-shadow: 0 0.25rem 1rem rgba(59, 130, 246, 0.10);
  transform: scale(1.05);
}

.rule-button:active {
  filter: brightness(0.90);
  transform: scale(0.95);
}

.rule-button.correct {
  background: #10B981;
  border-color: #10B981;
}

.rule-button.incorrect {
  background: #EF4444;
  border-color: #EF4444;
}

.rule-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.button-row {
  display: flex;
  gap: 10px;
}

.interactive-toggle {
  position: relative;
  display: inline-block;
  margin: 0 10px;
}

.interactive-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Progress container styling */
.progress-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  border: 1px solid #e2e8f0;
}

.progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.progress-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}

.progress-value {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

/* Transition table styling */
.transition-table-container {
  margin-top: 16px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.transition-table-container h5 {
  margin: 0 0 8px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.table-wrapper {
  overflow-x: auto;
}

.transition-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: white;
  border-radius: 6px;
  overflow: hidden;
}

.transition-table th,
.transition-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

.transition-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.transition-table tr:last-child td {
  border-bottom: none;
}

/* Minimization step display */
.minimization-step {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
  border-left: 4px solid #d1d5db;
}

.minimization-step.current {
  border-left-color: #3B82F6;
  background: #eff6ff;
  border-color: #3B82F6;
}

.minimization-step.completed {
  border-left-color: #10B981;
  background: #ecfdf5;
  border-color: #10B981;
  opacity: 0.8;
}

.minimization-step.alternate-dfa {
  border-left-color: #8B5CF6;
  background: #f3f4f6;
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.step-number {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3B82F6;
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 24px;
  margin-right: 8px;
}

.step-number.completed {
  background: #10B981;
}

.step-number.alternate {
  background: #8B5CF6;
}

.step-description {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
  font-size: 0.875rem;
}

.step-detail {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
}

.partition-display {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.partition-set {
  display: inline-flex;
  align-items: center;
  background: #e0f2fe;
  border: 1px solid #0ea5e9;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
}

.partition-set.final {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}

.partition-set.eliminated {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
  opacity: 0.7;
}

.state-in-partition {
  margin: 0 2px;
}

/* Canvas styling */
#dfa_canvas_left, #dfa_canvas_right {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  width: 100%;
  height: 300px;
}

/* Current action display */
.current-action-indicator {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.current-action-text {
  font-weight: 600;
  color: #92400e;
  font-size: 0.9rem;
}

.current-dfa-highlight {
  color: #3B82F6;
  font-weight: 700;
}

/* Action choice buttons */
.action-choice {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.4;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.action-choice:hover {
  border-color: #3B82F6;
  background: #f0f9ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.action-choice.selected {
  border-color: #3B82F6;
  background: #eff6ff;
}

.action-choice.correct {
  border-color: #10B981;
  background: #ecfdf5;
  color: #047857;
}

.action-choice.incorrect {
  border-color: #EF4444;
  background: #fef2f2;
  color: #dc2626;
}

.action-choice.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .progress-container {
    flex-direction: column;
    gap: 8px;
  }
  
  .progress-item {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  
  .action-choice {
    margin: 2px 0;
    min-height: 50px;
    font-size: 0.8rem;
  }
  
  .rule-button {
    min-width: 90px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* DFA Minimization Specific Styles */

.choice-button {
  background: rgba(140, 90, 255, 0.18);
  color: #5b21b6;
  border: 2px solid transparent;
  padding: 2px 4px;
  margin: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-family: monospace;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px 0 rgba(124, 58, 237, 0.04);
  min-width: 200px;
  text-align: center;
  display: block;
  width: 100%;
}

.choice-button:hover:not(:disabled) {
  background: rgba(140, 90, 255, 0.25);
  box-shadow: 0 3px 6px rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}

.choice-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.choice-button.correct {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.choice-button.incorrect {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Steps List Styling */
#minimization_steps_list_left li,
#minimization_steps_list_right li {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 6px;
  border-left: 4px solid #e5e7eb;
  list-style: none;
}

#minimization_steps_list_left li.completed,
#minimization_steps_list_right li.completed {
  background-color: #f0fdf4;
  border-left-color: #10b981;
  color: #166534;
}

#minimization_steps_list_left li.current,
#minimization_steps_list_right li.current {
  background-color: #fef3c7;
  border-left-color: #f59e0b;
  color: #92400e;
  animation: pulse 2s infinite;
}

#minimization_steps_list_left li.pending,
#minimization_steps_list_right li.pending {
  background-color: #f9fafb;
  border-left-color: #d1d5db;
  color: #6b7280;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* DFA Type Headers */
#dfa_type_left,
#dfa_type_right {
  padding: 8px 16px;
  border-radius: 6px;
  margin-bottom: 10px;
  text-align: center;
  font-weight: bold;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

#dfa_type_left.active,
#dfa_type_right.active {
  background-color: #E5F3FF;
  border-color: #3b82f6;
}
