.stage-header {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  min-width: 35px;
  max-width: 35px;
  font-size: 0.7rem;
  padding: 8px 4px !important;
  text-align: center;
  vertical-align: bottom;
}

.stage-cell {
  text-align: center;
  padding: 6px 4px !important;
  vertical-align: middle;
}

/* Status Indicator Styles */
.status-indicator {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  margin: 0 auto;
  border: 1px solid #ddd;
  cursor: help;
  transition: all 0.2s ease;
}

.status-indicator:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Status Colors */
.status-indicator.pass {
  background: #28a745;
  border-color: #28a745;
}

.status-indicator.fail {
  background: #dc3545;
  border-color: #dc3545;
}

.status-indicator.partial {
  background: #ffc107;
  border-color: #ffc107;
}

.status-indicator.not_started {
  background: #e9ecef;
  border-color: #adb5bd;
}

/* Not uploaded overlay - stripes on top of any background */
.status-indicator.not-uploaded {
  background-image: repeating-linear-gradient(
    315deg,
    transparent,
    transparent 4px,
    #999 4px,
    #999 6px
  );
}

.status-indicator.alternative {
  background: #6c757d;
  opacity: 0.5;
  border-color: #6c757d;
}

.status-indicator.no_tests {
  background: #6c757d;
  border-color: #6c757d;
}

.status-indicator.unknown {
  background: #343a40;
  border-color: #343a40;
}

.status-indicator.disabled {
  background: #e9ecef;
  border: 2px dashed #adb5bd;
  opacity: 0.7;
}

/* Legend Styles */
.dashboard-legend {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  margin-top: 20px;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 10px;
}

.legend-items span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  padding: 4px 8px;
  background: white;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.legend-items .status-indicator {
  width: 16px;
  height: 16px;
  cursor: default;
}

.legend-items .status-indicator:hover {
  transform: none;
  box-shadow: none;
}


/* Child Component Cards */
.card-title a {
  color: #0d6efd;
  text-decoration: none;
}

.card-title a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .stage-header {
    font-size: 0.6rem;
    min-width: 30px;
    max-width: 30px;
  }

  .status-indicator {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 768px) {
  .dashboard-matrix {
    font-size: 0.75rem;
  }

  .fixed-column {
    min-width: 120px;
  }

  .stage-header {
    font-size: 0.55rem;
    min-width: 25px;
    max-width: 25px;
  }

  .status-indicator {
    width: 18px;
    height: 18px;
  }

  .legend-items {
    flex-direction: column;
    gap: 8px;
  }

  .legend-items span {
    justify-content: flex-start;
  }
}

@media (max-width: 576px) {
  .dashboard-legend {
    padding: 10px;
  }

  .stage-header {
    font-size: 0.5rem;
    min-width: 22px;
    max-width: 22px;
    padding: 4px 2px !important;
  }

  .status-indicator {
    width: 16px;
    height: 16px;
  }

  .fixed-column {
    min-width: 100px;
    font-size: 0.8rem;
  }
}

/* Loading States */
.btn .fa-spinner {
  animation: spin 1s linear infinite;
}

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

/* Print Styles */
@media print {
  .dashboard-legend,
  .btn,
  .form-control,
  .accordion-button {
    display: none !important;
  }

  .accordion-collapse {
    display: block !important;
  }

  .status-indicator {
    border: 2px solid black !important;
    print-color-adjust: exact;
  }
}

/* Accessibility Improvements */
.status-indicator:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.module-row:focus-within {
  background-color: #fff3cd !important;
  outline: 2px solid #0d6efd;
}

/* Animation for Auto-refresh */
.refresh-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

/* Summary Cards */
.card .card-title {
  font-size: 2rem;
  font-weight: bold;
  color: #0d6efd;
}

.card .card-text {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Detail Page Matrix Styles */
.stage-row {
  cursor: pointer;
}

.stage-row:hover {
  background-color: #f8f9fa;
}

.test-indicators .badge {
  font-size: 0.7rem;
}

.stage-details {
  border-left: 3px solid #0d6efd;
}

.stage-details .card-sm {
  border: 1px solid #e9ecef;
}

.stage-details .card-sm:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-xs {
  padding: 0.125rem 0.25rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border-radius: 0.2rem;
}

td.stage-cell.table-primary {
  background-color: #b8daff !important; /* needed to override tablesorter-bootstrap */
}
