/* ========================================
   n8n Watchdog Dashboard — Clean Theme
   ======================================== */

:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-hover: #334155;
  --color-border: #334155;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-green: #22c55e;
  --color-green-bg: rgba(34, 197, 94, 0.1);
  --color-yellow: #eab308;
  --color-yellow-bg: rgba(234, 179, 8, 0.1);
  --color-red: #ef4444;
  --color-red-bg: rgba(239, 68, 68, 0.1);
  --color-grey: #64748b;
  --color-grey-bg: rgba(100, 116, 139, 0.1);
  --color-blue: #3b82f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Status Bar */
.status-bar {
  padding: 24px 0;
  transition: background 0.3s ease;
}

.status-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.status-title {
  font-size: 22px;
  font-weight: 700;
  color: white;
}

.status-message {
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
  color: white;
}

.status-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.auto-refresh-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.status-healthy { background: linear-gradient(135deg, #15803d, #16a34a); }
.status-degraded { background: linear-gradient(135deg, #a16207, #ca8a04); }
.status-failing { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.status-loading { background: linear-gradient(135deg, #475569, #64748b); }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Section Titles */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
}

section {
  margin-bottom: 40px;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.workflow-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
  box-shadow: var(--shadow);
}

.workflow-card:hover {
  border-color: var(--color-blue);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--color-green); box-shadow: 0 0 8px var(--color-green); }
.dot-yellow { background: var(--color-yellow); box-shadow: 0 0 8px var(--color-yellow); }
.dot-red { background: var(--color-red); box-shadow: 0 0 8px var(--color-red); }
.dot-grey { background: var(--color-grey); }

.card-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-status-label {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.label-healthy { background: var(--color-green-bg); color: var(--color-green); }
.label-degraded { background: var(--color-yellow-bg); color: var(--color-yellow); }
.label-failing { background: var(--color-red-bg); color: var(--color-red); }
.label-inactive { background: var(--color-grey-bg); color: var(--color-grey); }

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
}

.stat-value.good { color: var(--color-green); }
.stat-value.warn { color: var(--color-yellow); }
.stat-value.bad { color: var(--color-red); }
.stat-value.neutral { color: var(--color-text); }

/* Data Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

.data-table thead {
  background: var(--color-surface-hover);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: var(--color-surface-hover);
}

.data-table .row-failure {
  border-left: 3px solid var(--color-red);
}

.data-table .error-msg {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-red);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
}

.data-table a {
  color: var(--color-blue);
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 32px 16px !important;
}

/* Charts */
.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text-muted);
}

.chart-card canvas {
  width: 100% !important;
  max-height: 200px;
}

/* Loading */
.loading-placeholder {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px;
  font-size: 14px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 13px;
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .status-bar-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-meta {
    align-items: flex-start;
  }

  .status-message {
    font-size: 22px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .charts-container {
    grid-template-columns: 1fr;
  }

  .data-table th,
  .data-table td {
    padding: 8px 12px;
  }
}
