* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --dark: #1f2937;
  --darker: #111827;
  --light: #f9fafb;
  --border: #e5e7eb;
  --text: #374151;
  --text-light: #6b7280;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--darker);
  color: white;
  padding: 2rem;
  overflow-y: auto;
}

.logo h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.subtitle {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.test-controls {
  margin-top: 2rem;
}

.test-controls h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: white;
}

.test-controls h4 {
  font-size: 0.875rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-group {
  margin-bottom: 1.5rem;
}

/* Botones */
.btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #4f46e5;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #7c3aed;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.input-text {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  background: var(--dark);
  color: white;
}

.input-text:focus {
  outline: none;
  border-color: var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Monitor Dashboard */
.monitor-dashboard {
  max-width: 1400px;
  margin: 0 auto;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.monitor-header h2 {
  font-size: 2rem;
  color: var(--dark);
}

.monitor-actions {
  display: flex;
  gap: 1rem;
}

.monitor-actions .btn {
  width: auto;
  margin: 0;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary);
}

.metric-card.success {
  border-left-color: var(--success);
}

.metric-card.error {
  border-left-color: var(--danger);
}

.metric-card h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.metric-percentage {
  font-size: 1rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Queue Section */
.queue-section,
.rate-limiter-section,
.request-log-section {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.queue-section h3,
.rate-limiter-section h3,
.request-log-section h3 {
  font-size: 1.25rem;
  color: var(--dark);
  margin-bottom: 1rem;
}

.queue-stats,
.rate-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 1.5rem;
  background: var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 0.75rem;
}

.progress-fill.success {
  background: var(--success);
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--danger);
}

/* Request Log */
.request-log {
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
}

.log-entry {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.375rem;
  border-left: 3px solid;
  display: flex;
  gap: 1rem;
}

.log-entry.info {
  background: #eff6ff;
  border-left-color: var(--info);
}

.log-entry.success {
  background: #f0fdf4;
  border-left-color: var(--success);
}

.log-entry.warning {
  background: #fffbeb;
  border-left-color: var(--warning);
}

.log-entry.error {
  background: #fef2f2;
  border-left-color: var(--danger);
}

.log-time {
  color: var(--text-light);
  font-weight: 600;
  white-space: nowrap;
}

.log-message {
  flex: 1;
  color: var(--dark);
}

/* Scrollbar personalizado */
.request-log::-webkit-scrollbar {
  width: 8px;
}

.request-log::-webkit-scrollbar-track {
  background: var(--light);
  border-radius: 4px;
}

.request-log::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.request-log::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Responsive */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .monitor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .monitor-actions {
    width: 100%;
    flex-direction: column;
  }

  .monitor-actions .btn {
    width: 100%;
  }
}