/* ============================================================================
   GOLEGAL PIPELINE DASHBOARD - TOYOTA RED LAMP THEME
   ============================================================================
   Purpose: Comprehensive dashboard styling with Toyota RED lamp visual alerts
   Features: Animated RED lamp banner, pipeline visualization, responsive layout
   Author: AI Agent
   Created: 2025-11-12
   ============================================================================ */

/* ============================================================================
   1. ANIMATIONS
   ============================================================================ */

/* RED lamp pulse animation for banner */
@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

/* Active stage pulse animation (blue) */
@keyframes pulse-blue {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Blink animation for RED lamp cells */
@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0.3;
  }
}

/* Progress bar fill animation */
@keyframes progress-fill {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   2. TOYOTA RED LAMP BANNER
   ============================================================================ */

/* RED lamp alert banner container */
.red-lamp-banner {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: 3px solid #dc2626;
  border-radius: 8px;
  padding: 16px 24px;
  margin-bottom: 24px;
  animation: pulse-red 2s infinite;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transition: all 0.3s ease;
}

.red-lamp-banner:hover {
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.6);
  transform: translateY(-2px);
}

/* RED lamp banner header */
.red-lamp-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* RED lamp icon */
.red-lamp-icon {
  font-size: 32px;
  animation: blink 1s infinite;
}

/* RED lamp title */
.red-lamp-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* RED lamp count badge */
.red-lamp-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  margin-left: auto;
}

/* RED lamp message */
.red-lamp-message {
  color: #ffffff;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* ============================================================================
   3. STATS GRID
   ============================================================================ */

/* Stats container - responsive grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

/* Individual stat card */
.stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease;
}

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

/* Stat card header */
.stat-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* Stat icon */
.stat-icon {
  font-size: 24px;
}

/* Stat label */
.stat-label {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stat value */
.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 8px;
}

/* Stat description */
.stat-description {
  font-size: 13px;
  color: #9ca3af;
  margin: 0;
}

/* Color variants for stats */
.stat-card.success .stat-value {
  color: #10b981;
}

.stat-card.warning .stat-value {
  color: #f59e0b;
}

.stat-card.danger .stat-value {
  color: #dc2626;
}

.stat-card.info .stat-value {
  color: #3b82f6;
}

/* ============================================================================
   4. PIPELINE VISUALIZATION
   ============================================================================ */

/* Pipeline container */
.pipeline-container {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Pipeline title */
.pipeline-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 20px;
}

/* Pipeline stages flow */
.pipeline-stages {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 0;
}

/* Individual pipeline stage */
.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  position: relative;
  transition: all 0.3s ease;
}

/* Stage icon container */
.stage-icon-container {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 8px;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

/* Stage states */
.pipeline-stage.pending .stage-icon-container {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}

.pipeline-stage.active .stage-icon-container {
  background: #dbeafe;
  color: #3b82f6;
  border-color: #3b82f6;
  animation: pulse-blue 2s infinite;
}

.pipeline-stage.completed .stage-icon-container {
  background: #d1fae5;
  color: #10b981;
  border-color: #10b981;
}

.pipeline-stage.failed .stage-icon-container {
  background: #fee2e2;
  color: #dc2626;
  border-color: #dc2626;
}

/* Stage label */
.stage-label {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: #6b7280;
  max-width: 100px;
  word-wrap: break-word;
}

.pipeline-stage.active .stage-label {
  color: #3b82f6;
  font-weight: 700;
}

.pipeline-stage.completed .stage-label {
  color: #10b981;
}

.pipeline-stage.failed .stage-label {
  color: #dc2626;
}

/* Stage arrow connector */
.stage-arrow {
  font-size: 20px;
  color: #d1d5db;
  flex-shrink: 0;
}

.pipeline-stage.completed + .stage-arrow {
  color: #10b981;
}

/* Progress bar under pipeline */
.pipeline-progress {
  width: 100%;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}

.pipeline-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 2px;
  transition: width 0.5s ease;
  animation: progress-fill 0.5s ease;
}

/* ============================================================================
   5. UPLOADS TABLE
   ============================================================================ */

/* Table container */
.uploads-table-container {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Table header */
.table-header {
  background: #f9fafb;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.table-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

/* Table wrapper for scroll */
.table-wrapper {
  overflow-x: auto;
}

/* Main table */
.uploads-table {
  width: 100%;
  border-collapse: collapse;
}

/* Table head */
.uploads-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.uploads-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Table body */
.uploads-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.uploads-table tbody tr:hover {
  background-color: #f9fafb;
}

.uploads-table td {
  padding: 16px;
  font-size: 14px;
  color: #374151;
  vertical-align: middle;
}

/* RED lamp table rows - highlighted with border */
.uploads-table tbody tr.red-lamp-row {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  border-right: 4px solid #dc2626;
}

.uploads-table tbody tr.red-lamp-row:hover {
  background: #fee2e2;
}

/* RED lamp indicator cell */
.red-lamp-cell {
  font-size: 20px;
  animation: blink 1.5s infinite;
  text-align: center;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.completed {
  background: #d1fae5;
  color: #065f46;
}

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

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

.status-badge.pending {
  background: #f3f4f6;
  color: #6b7280;
}

/* Action buttons */
.action-button {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

.action-button:active {
  transform: scale(0.98);
}

/* File name cell with icon */
.file-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-icon {
  font-size: 18px;
  color: #3b82f6;
  flex-shrink: 0;
}

.file-name {
  font-weight: 500;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   6. DETAIL MODAL
   ============================================================================ */

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

/* Modal container */
.modal-container {
  background: #ffffff;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: fadeIn 0.3s ease;
}

/* Modal header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.modal-close-button {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: all 0.2s ease;
}

.modal-close-button:hover {
  color: #1f2937;
  transform: scale(1.1);
}

/* Modal body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

/* Detail sections */
.detail-section {
  margin-bottom: 24px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

/* Timeline for stage progression */
.stage-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.timeline-icon.completed {
  background: #d1fae5;
  color: #10b981;
}

.timeline-icon.active {
  background: #dbeafe;
  color: #3b82f6;
}

.timeline-icon.pending {
  background: #f3f4f6;
  color: #9ca3af;
}

.timeline-icon.failed {
  background: #fee2e2;
  color: #dc2626;
}

.timeline-content {
  flex: 1;
}

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.timeline-time {
  font-size: 12px;
  color: #9ca3af;
}

/* ============================================================================
   7. HEALTH INDICATORS
   ============================================================================ */

/* Health status indicator */
.health-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-indicator.healthy {
  background: #d1fae5;
  color: #065f46;
}

.health-indicator.degraded {
  background: #fef3c7;
  color: #92400e;
}

.health-indicator.unhealthy {
  background: #fee2e2;
  color: #991b1b;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

.health-indicator.healthy .health-dot {
  background: #10b981;
}

.health-indicator.degraded .health-dot {
  background: #f59e0b;
}

.health-indicator.unhealthy .health-dot {
  background: #dc2626;
}

/* ============================================================================
   8. RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet and smaller */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-stages {
    flex-direction: column;
    align-items: flex-start;
  }

  .stage-arrow {
    transform: rotate(90deg);
    margin: 8px 0;
  }

  .uploads-table {
    font-size: 12px;
  }

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

  .modal-container {
    width: 95%;
  }

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

/* Mobile */
@media (max-width: 480px) {
  .red-lamp-banner {
    padding: 12px 16px;
  }

  .red-lamp-title {
    font-size: 16px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .pipeline-container {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .table-wrapper {
    overflow-x: scroll;
  }

  /* Hide less critical columns on mobile */
  .uploads-table .hide-mobile {
    display: none;
  }
}

/* ============================================================================
   9. UTILITY CLASSES
   ============================================================================ */

/* Loading spinner */
.loading-spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 14px;
  color: #9ca3af;
}

/* Error state */
.error-state {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.error-state-title {
  font-size: 16px;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 8px;
}

.error-state-message {
  font-size: 14px;
  color: #991b1b;
  margin: 0;
}

/* Tooltip */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  margin-bottom: 8px;
}

.tooltip:hover::after {
  opacity: 1;
}

/* ============================================================================
   10. ACCESSIBILITY
   ============================================================================ */

/* Focus styles for keyboard navigation */
button:focus,
.action-button:focus,
.modal-close-button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .red-lamp-banner {
    border-width: 4px;
  }

  .status-badge,
  .health-indicator {
    border: 2px solid currentColor;
  }
}

/* ============================================================================
   END OF STYLESHEET
   ============================================================================ */
