/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* Scheduler Control */
.scheduler-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

.scheduler-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--gray-400);
}

.status-dot.running {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.stopped {
  background-color: var(--danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-badge.running {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.stopped {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-badge.paused {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.completed {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.failed {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-badge.pending {
  background-color: var(--gray-100);
  color: var(--gray-600);
}

.status-badge.enabled {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.disabled {
  background-color: var(--gray-100);
  color: var(--gray-500);
}

/* Navigation */
nav {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 20px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 8px;
}

nav a {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--gray-600);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

nav a:hover {
  color: var(--gray-900);
}

nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
}

.card-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 16px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background-color: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
}

tr:hover {
  background-color: var(--gray-50);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

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

.btn-success:hover {
  background-color: #059669;
}

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

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

.btn-outline {
  background-color: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background-color: var(--gray-50);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 0.8125rem;
}

.btn-group {
  display: flex;
  gap: 8px;
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background-color: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

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

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

/* Logs */
.log-container {
  background-color: var(--gray-900);
  border-radius: 8px;
  padding: 16px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  max-height: 500px;
  overflow-y: auto;
}

.log-line {
  color: var(--gray-300);
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line.error {
  color: #f87171;
}

.log-line.warn {
  color: #fbbf24;
}

.log-line.info {
  color: #60a5fa;
}

/* Grid */
.grid {
  display: grid;
  gap: 16px;
}

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

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

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Stats */
.stat-card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  padding: 20px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Execution list item */
.execution-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
}

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

.execution-info {
  flex: 1;
}

.execution-name {
  font-weight: 500;
  color: var(--gray-900);
}

.execution-meta {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.execution-progress {
  width: 200px;
  margin: 0 20px;
}

/* Tab navigation */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--gray-900);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: auto;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--gray-500);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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

/* Utilities */
.text-muted {
  color: var(--gray-500);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-sm {
  font-size: 0.875rem;
}

.mt-2 {
  margin-top: 8px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.hidden {
  display: none !important;
}

.ml-2 {
  margin-left: 8px;
}

.font-medium {
  font-weight: 500;
}

/* Scheduled Workflows Table */
.next-run {
  color: var(--gray-600);
  font-size: 0.875rem;
}

.next-run.soon {
  color: var(--warning);
  font-weight: 500;
}
