/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background-color: #2c3e50;
  color: white;
  padding: 1.5rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.header-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 300;
}

.back-link {
  display: inline-block;
  color: white;
  text-decoration: none;
  margin-bottom: 1rem;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 1;
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

/* Filters Section */
.filters {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

.filter-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
}

.filter-group select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  background-color: white;
  cursor: pointer;
}

/* Rules List */
.rules-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2.5rem;
}

.rule-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.rule-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.rule-card-placeholder {
  background: #fafafa;
  border: 2px dashed #ddd;
  opacity: 0.7;
  cursor: default;
}

.rule-card-placeholder:hover {
  transform: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rule-card-placeholder .rule-card-title {
  color: #999;
}

.placeholder-message {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.rule-card-title {
  font-size: 1.2rem;
  color: #2c3e50;
  font-weight: 600;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.draft {
  background-color: #e3f2fd;
  color: #1976d2;
}

.status-badge.reviewed {
  background-color: #e8f5e9;
  color: #388e3c;
}

.status-badge.needs_work {
  background-color: #fff3e0;
  color: #f57c00;
}

.status-badge.approved {
  background-color: #f3e5f5;
  color: #7b1fa2;
}

.status-badge.not-configured {
  background-color: #f5f5f5;
  color: #999;
  border: 1px dashed #ccc;
}

.rule-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: #666;
  font-size: 0.9rem;
  flex: 1;
}

.rule-card-meta-item {
  display: flex;
  justify-content: space-between;
}

.rule-card-meta-label {
  font-weight: 600;
}

/* Rule Details */
.rule-details {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.rule-title {
  font-size: 2rem;
  color: #2c3e50;
}

.rule-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.rule-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rule-meta-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rule-meta-value {
  font-size: 1rem;
  color: #333;
}

/* Rule Content */
.rule-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.rule-content h2 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

.yaml-viewer {
  background-color: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}

.yaml-viewer pre {
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #24292e;
}

.citations-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e1e4e8;
}

.citations-section h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

.citation-item {
  background-color: #f8f9fa;
  padding: 1rem;
  border-left: 3px solid #2c3e50;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.citation-source {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.citation-details {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.citation-excerpt {
  font-style: italic;
  color: #555;
  font-size: 0.9rem;
  padding: 0.5rem;
  background-color: white;
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* Rule Navigation */
.rule-navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-button {
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  background-color: #2c3e50;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: center;
}

.nav-button:hover {
  background-color: #34495e;
}

.nav-button:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: #666;
  font-size: 1.1rem;
}

.error {
  background-color: #ffebee;
  color: #c62828;
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid #c62828;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-title {
    font-size: 1.5rem;
  }

  .filters {
    flex-direction: column;
    gap: 1rem;
  }

  .rules-list {
    grid-template-columns: 1fr;
  }

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

  .rule-meta-grid {
    grid-template-columns: 1fr;
  }

  .rule-navigation {
    flex-direction: column;
  }

  .nav-button {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .header {
    padding: 1rem 0;
  }

  .header-title {
    font-size: 1.3rem;
  }

  .rule-details,
  .rule-content {
    padding: 1rem;
  }

  .yaml-viewer pre {
    font-size: 0.8rem;
  }

  .content-with-chat {
    flex-direction: column;
  }

  .left-column {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 2rem;
  }

  .chat-container {
    max-height: 400px;
  }
}

/* Chat Interface Styles */
.content-with-chat {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.left-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border-right: 1px solid #e0e0e0;
  padding-right: 2rem;
}

.rule-content {
  flex: 1;
  min-width: 0;
}

.chat-container {
  width: 400px;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 600px;
}

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.chat-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #2c3e50;
}

.clear-chat-btn {
  padding: 0.4rem 0.8rem;
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  transition: all 0.2s;
}

.clear-chat-btn:hover {
  background-color: #f0f0f0;
  color: #333;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 300px;
  max-height: 400px;
}

.chat-welcome {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  color: #666;
  font-size: 0.9rem;
  text-align: center;
  border: 1px dashed #ddd;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 85%;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.user .message-content {
  background-color: #2c3e50;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  background-color: #e9ecef;
  color: #333;
  border-bottom-left-radius: 4px;
}

.update-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background-color: #28a745;
  color: white;
  font-size: 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  align-self: flex-start;
}

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 0.75rem;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
}

.chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
}

.chat-input:focus {
  outline: none;
  border-color: #2c3e50;
  box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.send-message-btn {
  padding: 0.75rem 1.5rem;
  background-color: #2c3e50;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  align-self: flex-end;
}

.send-message-btn:hover:not(:disabled) {
  background-color: #1a252f;
}

.send-message-btn:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

/* Rule Update Notification */
.rule-update-notification {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notification-content strong {
  display: block;
  color: #155724;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.notification-content p {
  color: #155724;
  margin-bottom: 1rem;
}

.notification-actions {
  display: flex;
  gap: 0.75rem;
}

.notification-actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.apply-btn {
  background-color: #28a745;
  color: white;
}

.apply-btn:hover {
  background-color: #218838;
}

.dismiss-btn {
  background-color: transparent;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.dismiss-btn:hover {
  background-color: #c3e6cb;
}

/* ============================================================================
   Test Runner Styles
   ============================================================================ */

.test-runner-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.test-runner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.test-runner-header h3 {
  margin: 0;
  color: #212529;
  font-size: 1.25rem;
}

.run-tests-btn {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
}

.run-tests-btn:hover:not(:disabled) {
  background-color: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.run-tests-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.test-results {
  min-height: 100px;
}

.test-summary {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.test-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.test-stat {
  text-align: center;
  padding: 1rem;
  background: white;
  border-radius: 6px;
  border: 2px solid #dee2e6;
}

.test-stat-passed {
  border-color: #28a745;
}

.test-stat-failed {
  border-color: #dc3545;
}

.pass-rate-perfect {
  border-color: #28a745;
  background-color: #d4edda;
}

.pass-rate-good {
  border-color: #ffc107;
  background-color: #fff3cd;
}

.pass-rate-poor {
  border-color: #dc3545;
  background-color: #f8d7da;
}

.test-stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #212529;
  margin-bottom: 0.25rem;
}

.test-stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-file-link {
  text-align: center;
  padding-top: 0.75rem;
  border-top: 1px solid #dee2e6;
}

.test-file-link a {
  color: #007bff;
  text-decoration: none;
  font-size: 0.9rem;
}

.test-file-link a:hover {
  text-decoration: underline;
}

.test-results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.test-result {
  border: 2px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem;
  background: white;
  transition: all 0.2s;
}

.test-result:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.test-result-passed {
  border-left: 4px solid #28a745;
}

.test-result-failed {
  border-left: 4px solid #dc3545;
}

.test-result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.test-result-status {
  font-weight: bold;
  font-size: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

.test-result-passed .test-result-status {
  color: #28a745;
  background-color: #d4edda;
}

.test-result-failed .test-result-status {
  color: #dc3545;
  background-color: #f8d7da;
}

.test-result-id {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #6c757d;
  font-size: 0.9rem;
}

.test-result-description {
  color: #212529;
  font-size: 0.95rem;
  flex: 1;
}

.test-result-failures {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8d7da;
  border-radius: 4px;
  border-left: 4px solid #dc3545;
}

.test-result-failures-header {
  font-weight: bold;
  color: #721c24;
  margin-bottom: 0.5rem;
}

.test-result-failures-list {
  margin: 0;
  padding-left: 1.5rem;
  color: #721c24;
}

.test-result-failures-list li {
  margin-bottom: 0.5rem;
}

.test-result-diff {
  margin-top: 1rem;
}

.test-result-diff details {
  cursor: pointer;
}

.test-result-diff summary {
  font-weight: 600;
  color: #495057;
  padding: 0.5rem;
  background-color: #e9ecef;
  border-radius: 4px;
  user-select: none;
}

.test-result-diff summary:hover {
  background-color: #dee2e6;
}

.test-result-diff-content {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.test-result-diff-section {
  background: white;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}

.test-result-diff-section strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #495057;
}

.test-result-diff-section pre {
  margin: 0;
  font-size: 0.85rem;
  color: #212529;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 4px;
  overflow-x: auto;
}

.no-tests {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  font-style: italic;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 4px;
  border-left: 4px solid #dc3545;
}

/* Responsive design for test runner */
@media (max-width: 768px) {
  .test-summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .test-result-diff-content {
    grid-template-columns: 1fr;
  }

  .test-result-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Approval Page Styles */
.approval-section {
  background: white;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.approval-section h2 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.5rem;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.5rem;
}

.approval-section h3 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #34495e;
  font-size: 1.2rem;
}

/* Rule Overview */
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metadata-item.full-width {
  grid-column: 1 / -1;
}

.metadata-item .label {
  font-weight: 600;
  color: #7f8c8d;
  font-size: 0.875rem;
  text-transform: uppercase;
}

.metadata-item .value {
  color: #2c3e50;
  font-size: 1rem;
}

/* Validation Status */
.validation-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 1rem;
  border-radius: 4px;
  font-weight: 500;
}

.validation-errors {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 1rem;
  border-radius: 4px;
}

.validation-errors ul {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
}

.validation-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.info-message {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
  padding: 1rem;
  border-radius: 4px;
}

/* Changes Summary */
.changes-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 4px solid #3498db;
}

.summary-item.full-width {
  grid-column: 1 / -1;
}

/* Changes Detail */
.changes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.change-item {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
  background-color: #f8f9fa;
}

.change-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.change-category {
  background-color: #3498db;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.change-field {
  font-family: 'Courier New', monospace;
  background-color: #e9ecef;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

.change-description {
  margin-bottom: 0.75rem;
  color: #495057;
}

.change-diff summary {
  cursor: pointer;
  color: #3498db;
  font-weight: 500;
  padding: 0.5rem;
  background-color: #e7f3ff;
  border-radius: 4px;
  user-select: none;
}

.change-diff summary:hover {
  background-color: #d0e9ff;
}

.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 1rem;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.diff-old,
.diff-new {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.diff-old strong {
  color: #dc3545;
}

.diff-new strong {
  color: #28a745;
}

.diff-old pre,
.diff-new pre {
  background-color: #f8f9fa;
  padding: 0.75rem;
  border-radius: 4px;
  border-left: 4px solid #dc3545;
  overflow-x: auto;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.diff-new pre {
  border-left-color: #28a745;
}

/* Test Results in Approval */
.test-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.test-stat {
  text-align: center;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #dee2e6;
}

.stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
}

.stat-value.passed {
  color: #28a745;
}

.stat-value.failed {
  color: #dc3545;
}

.stat-value.perfect {
  color: #28a745;
}

.stat-value.good {
  color: #ffc107;
}

.stat-value.poor {
  color: #dc3545;
}

.test-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 1rem;
  border-radius: 4px;
  font-weight: 500;
  text-align: center;
}

.test-failures {
  margin-top: 1rem;
}

.test-failure-item {
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-left: 4px solid #dc3545;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
}

.test-failure-item .test-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.test-failure-item .failure-reason {
  color: #721c24;
  font-size: 0.875rem;
}

/* Citations in Approval */
.citations-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.citation-item {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
  background-color: #fff;
}

.citation-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e9ecef;
}

.citation-number {
  background-color: #3498db;
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}

.citation-type {
  background-color: #e7f3ff;
  color: #0066cc;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.citation-content p {
  margin-bottom: 0.5rem;
  color: #495057;
  line-height: 1.6;
}

.citation-content a {
  color: #3498db;
  text-decoration: none;
  word-break: break-all;
}

.citation-content a:hover {
  text-decoration: underline;
}

/* Interpretation Decisions */
.interpretation-decisions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.interpretation-item {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
  background-color: #fff;
  border-left: 4px solid #f39c12;
}

.interpretation-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e9ecef;
}

.interpretation-number {
  background-color: #f39c12;
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.interpretation-section {
  background-color: #fff3cd;
  color: #856404;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.interpretation-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.interpretation-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.interpretation-field strong {
  color: #2c3e50;
  font-weight: 600;
}

.interpretation-field > div {
  color: #495057;
  line-height: 1.6;
  padding-left: 0.5rem;
}

.ambiguous-text {
  background-color: #fff9e6;
  padding: 0.75rem;
  border-left: 3px solid #f39c12;
  border-radius: 4px;
  font-style: italic;
  color: #856404;
}

.interpretation-alternatives {
  margin-top: 0.5rem;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 0.5rem;
  background-color: #f8f9fa;
}

.interpretation-alternatives summary {
  cursor: pointer;
  font-weight: 600;
  color: #6c757d;
  padding: 0.5rem;
  list-style-position: outside;
}

.interpretation-alternatives summary:hover {
  color: #495057;
}

.interpretation-alternatives ul {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
  padding-left: 1rem;
}

.interpretation-alternatives li {
  color: #6c757d;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.interpretation-note {
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  color: #004085;
  font-size: 0.875rem;
}

.interpretation-note strong {
  font-weight: 600;
}

/* Cross-References */
.cross-references-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cross-reference-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cross-reference-type-header {
  color: #6f42c1;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  margin-bottom: 0.25rem;
}

.cross-reference-type-description {
  color: #6c757d;
  font-size: 0.875rem;
  margin: 0 0 0.5rem 0;
}

.cross-reference-item {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
  background-color: #fff;
  border-left: 4px solid #6f42c1;
}

.cross-reference-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e9ecef;
}

.cross-reference-badge {
  background-color: #6f42c1;
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.cross-reference-sections {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.cross-reference-sections strong {
  background-color: #f3e8ff;
  color: #6f42c1;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 500;
}

.relationship-arrow {
  color: #6c757d;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: lowercase;
  padding: 0 0.25rem;
}

.cross-reference-content {
  color: #495057;
  line-height: 1.6;
  padding-left: 0.5rem;
}

.cross-reference-note {
  background-color: #f3e8ff;
  border: 1px solid #d6bcfa;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  color: #553c9a;
  font-size: 0.875rem;
}

.cross-reference-note strong {
  font-weight: 600;
}

.cross-references-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.interpretation-decisions-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.interpretation-decisions-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e9ecef;
}

/* Approval Form */
.approval-form {
  max-width: 600px;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.form-group input[type='email'],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group input[type='email']:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary {
  background-color: #28a745;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #218838;
}

.btn-secondary {
  background-color: #dc3545;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #c82333;
}

/* Submit for Approval Button */
.submit-approval-btn {
  background-color: #3498db;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1rem;
}

.submit-approval-btn:hover {
  background-color: #2980b9;
}

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

/* Responsive design for approval page */
@media (max-width: 768px) {
  .metadata-grid,
  .changes-summary-grid {
    grid-template-columns: 1fr;
  }

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

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

  .button-group {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .test-summary {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Extraction Review Styles
   ======================================== */

.extraction-review {
  background-color: #fff9e6;
  border-left: 4px solid #ff9800;
}

.extraction-review-notice {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.extraction-review-notice p {
  margin-bottom: 0.5rem;
}

.extraction-review-notice p:last-child {
  margin-bottom: 0;
}

.extraction-metadata {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.extraction-metadata h4 {
  margin-bottom: 0.75rem;
  color: #2c3e50;
  font-size: 1.1rem;
}

.extraction-review-form {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1.5rem;
}

.extraction-review-form h4 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.1rem;
}

.extraction-review-form small {
  display: block;
  margin-top: 0.5rem;
  color: #6c757d;
  font-size: 0.875rem;
}

.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

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

/* ===== EXTRACTION WORKFLOW STYLES ===== */

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 1.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #555;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Source Document List */
.source-document-item {
  display: grid;
  grid-template-columns: 2fr 2fr 1.5fr auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

/* Extraction Status Section */
.extraction-status {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.extraction-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.extraction-status-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.5rem;
}

.extraction-info {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.extraction-info h3 {
  margin-top: 0;
  color: #2c3e50;
}

.extraction-info p {
  margin: 0.5rem 0;
}

/* Extraction Stats */
.extraction-stats {
  margin-bottom: 1.5rem;
}

.extraction-stats h4 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background-color: #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: white;
  font-weight: 600;
}

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

.stat-item {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-label {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2c3e50;
}

/* Extraction Actions */
.extraction-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .source-document-item {
    grid-template-columns: 1fr;
  }

  .extraction-actions {
    flex-direction: column;
  }

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