/* css/simulator.css - Simulador de Fallas de DB */

/* Input container styling */
.input-container {
  background: var(--background-card);
  border-radius: 0.5rem;
  border: 1px solid var(--border-cyan);
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(0, 217, 255, 0.1);
}

.input-container:hover {
  border-color: var(--primary-cyan);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 217, 255, 0.2);
}

/* Input fields styling */
.input-field {
  font-family: 'JetBrains Mono', monospace;
  background: var(--background-dark);
  color: var(--text-primary);
  border: 2px solid var(--border-cyan);
  transition: all 0.3s ease;
  box-shadow: 
    inset 0 0 10px rgba(0, 217, 255, 0.1),
    0 0 5px rgba(0, 217, 255, 0.2);
  font-size: 0.875rem;
}

.input-field:focus {
  border-color: var(--primary-cyan);
  box-shadow: 
    inset 0 0 15px rgba(0, 217, 255, 0.2),
    0 0 15px rgba(0, 217, 255, 0.4);
  background: var(--background-dark);
  color: var(--text-primary);
}

.input-field::placeholder {
  color: var(--text-secondary);
}

/* Transaction graphs */
.transaction-graph {
  width: 100%;
  height: 120px;
  background: var(--background-dark);
  border: 1px solid var(--border-cyan);
  border-radius: 0.5rem;
  box-shadow: 
    inset 0 0 10px rgba(0, 217, 255, 0.1),
    0 0 5px rgba(0, 217, 255, 0.2);
}

/* Terminal styling */
.terminal-header {
  background: var(--secondary-navy);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
}

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

.terminal-content {
  padding: 0.75rem;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.3;
}

.terminal-line {
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.terminal-line.error {
  color: #FF5555;
}

.terminal-line.warning {
  color: #FFB86C;
}

.terminal-line.success {
  color: var(--terminal-green);
}

.terminal-line.info {
  color: var(--primary-cyan);
}

/* Terminal typing animation */
.typing-line {
  overflow: hidden;
  border-right: 2px solid var(--terminal-green);
  white-space: nowrap;
  animation: typing 1.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--terminal-green); }
}

/* Status indicators */
.status-normal {
  color: var(--terminal-green) !important;
}

.status-failure {
  color: #FF5555 !important;
  animation: pulse-red 1s ease-in-out infinite;
}

.status-recovery {
  color: var(--accent-green) !important;
  animation: pulse-green 1s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Cost Analysis Section */
.cost-section {
  background: var(--background-card);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-dark);
  transition: all 0.3s ease;
}

.ha-costs {
  border-left: 4px solid var(--terminal-green);
}

.no-ha-costs {
  border-left: 4px solid #FF5555;
}

.cost-item {
  display: flex;
  justify-content: between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 217, 255, 0.1);
}

.cost-item:last-child {
  border-bottom: none;
}

.cost-label {
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  flex: 1;
  margin-right: 1rem;
}

.cost-value {
  color: var(--primary-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: right;
  text-shadow: 0 0 8px var(--primary-cyan);
}

.cost-total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--primary-cyan);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cost-total .cost-value {
  font-size: 1.25rem;
  color: var(--terminal-green);
  text-shadow: 
    0 0 10px var(--terminal-green),
    0 0 15px var(--terminal-green);
}

/* Button states */
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--border-dark);
}

.btn-primary:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Simulation states */
.simulator-container.simulating {
  border-color: #FFB86C;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 184, 108, 0.3),
    0 0 20px rgba(255, 184, 108, 0.3);
}

.simulator-container.failure {
  border-color: #FF5555;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 85, 85, 0.3),
    0 0 20px rgba(255, 85, 85, 0.3);
}

.simulator-container.recovery {
  border-color: var(--terminal-green);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(0, 255, 136, 0.3),
    0 0 20px rgba(0, 255, 136, 0.3);
}

.simulator-container.completed {
  border-color: var(--terminal-green);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(0, 255, 136, 0.3),
    0 0 20px rgba(0, 255, 136, 0.3);
}

/* Loading animation for simulation */
.loading-simulation {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.loading-simulation::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--primary-cyan);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress indicators */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--background-dark);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-cyan), var(--accent-green));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

/* Highlight effects */
.highlight-success {
  animation: highlight-green 2s ease-in-out;
}

.highlight-error {
  animation: highlight-red 2s ease-in-out;
}

@keyframes highlight-green {
  0% { background-color: transparent; }
  50% { background-color: rgba(0, 255, 136, 0.2); }
  100% { background-color: transparent; }
}

@keyframes highlight-red {
  0% { background-color: transparent; }
  50% { background-color: rgba(255, 85, 85, 0.2); }
  100% { background-color: transparent; }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .terminal-content {
    min-height: 150px;
    max-height: 200px;
    font-size: 0.7rem;
    padding: 0.5rem;
  }
  
  .transaction-graph {
    height: 100px;
  }
  
  .cost-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .cost-value {
    text-align: left;
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .simulator-container {
    min-height: 400px;
  }
  
  .terminal-content {
    min-height: 120px;
    max-height: 180px;
    font-size: 0.65rem;
    padding: 0.5rem;
    line-height: 1.2;
  }
  
  .terminal-line {
    font-size: 0.65rem;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  
  .transaction-graph {
    height: 80px;
  }
  
  .cost-section {
    padding: 1rem;
  }
  
  .input-field {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
  
  .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Custom scrollbar for terminal */
.terminal-content::-webkit-scrollbar {
  width: 6px;
}

.terminal-content::-webkit-scrollbar-track {
  background: var(--background-dark);
}

.terminal-content::-webkit-scrollbar-thumb {
  background: var(--primary-cyan);
  border-radius: 3px;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary-cyan-hover);
}

/* Accessibility improvements */
.cost-item:hover {
  background: rgba(0, 217, 255, 0.05);
  border-radius: 0.25rem;
}

.terminal-line:hover {
  background: rgba(0, 217, 255, 0.03);
}

/* Focus indicators */
.input-field:focus,
.btn-primary:focus {
  outline: 2px solid var(--primary-cyan);
  outline-offset: 2px;
}

/* Animation for cost calculation */
.cost-calculating {
  animation: cost-pulse 1s ease-in-out infinite;
}

@keyframes cost-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Success message styling */
.success-message {
  background: linear-gradient(135deg, var(--terminal-green), var(--accent-green));
  color: var(--background-dark);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  font-weight: 600;
  margin: 1rem 0;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
