/* Digital Factory Design System - Clean & Minimal */

:root {
  /* Colors - Updated scheme */
  --primary: #007bff;
  --primary-dark: #0056b3;
  --info: #ff6b35;
  --info-dark: #e55a2b;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --light: #f8f9fa;
  --dark: #343a40;
  --white: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Radius */
  --radius: 0.375rem;
  --radius-lg: 0.5rem;

  /* Shadow */
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Header */
  --header-height: 56px; /* used for sticky subheader offset */
}

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

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--light);
}

/* Header */
.header {
  background: var(--dark);
  color: var(--white);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1100;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--info);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

/* Icons - Flat SVG style */
.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  fill: currentColor;
}

.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.col-span-2 { grid-column: span 2; }
.col-span-5 { grid-column: span 5; }

/* Container and Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
}

.pairs-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Event-Action Pair Layout */
.event-action-pair {
  display: grid;
  grid-template-columns: 5fr 2fr 5fr;
  gap: var(--space-4);
  align-items: start;
}

/* Event Card (Issue Card) */
.event-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  position: relative;
  border-top: 4px solid var(--danger);
}

.event-card .issue-id-chip {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--danger);
  color: var(--white);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}

.event-card .issue-id-chip:hover {
  background: #c82333;
}

.event-card-header {
  margin-bottom: var(--space-4);
}

.event-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--danger);
}

.event-card-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Relationship Card (Middle Panel) */
.relationship-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  border-top: 4px solid var(--primary);
}

.relationship-card .resolution-detail {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.relationship-card .resolution-source {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.ai-icon {
  color: var(--info);
  font-size: var(--text-lg);
}

.user-icon {
  color: var(--success);
  font-size: var(--text-lg);
}

/* Placeholder for no resolution */
.relationship-placeholder {
  background: transparent;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  opacity: 0.6;
}

/* Action Card */
.action-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  position: relative;
  border-top: 4px solid var(--success);
}

.action-card.hollow {
  background: transparent;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  opacity: 0.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 200px;
}

.action-card .action-id-chip {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--success);
  color: var(--white);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}

.action-card .action-id-chip:hover {
  background: #218838;
}

.action-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: center;
}

.action-card-header {
  margin-bottom: var(--space-4);
}

.action-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--success);
}

.action-card-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.assigned-to {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
}

.due-date {
  font-weight: 600;
}

.due-date.overdue {
  color: var(--danger);
}

/* Status Badge */
.status-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.completed {
  background: #d4edda;
  color: #155724;
}

.status-badge.todo {
  background: #fff3cd;
  color: #856404;
}

.status-badge.in-progress {
  background: #d1ecf1;
  color: #0c5460;
}

/* Filter Panel */
.filter-panel {
  transition: all 0.3s ease;
}

/* Sticky subheader (title + actions row) */
.sticky-subheader {
  position: sticky;
  top: var(--header-height);
  z-index: 1090;
  background: var(--light);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.btn-outline {
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--light);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.form-control {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Titles */
.ds-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
}

/* Responsive Design */
@media (max-width: 768px) {
  .event-action-pair {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

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

  .container {
    padding: var(--space-4);
  }
}
