/* ============================================
   Atomic Lab Data Display Components
   Tables, lists, and data visualization
   ============================================ */

/* Data Display Variables */
:root {
  --table-bg: #0a0a0a;
  --table-border: rgba(0, 255, 255, 0.2);
  --table-stripe-bg: rgba(0, 255, 255, 0.02);
  --table-hover-bg: rgba(0, 255, 255, 0.05);
  --table-header-bg: #111111;
  --table-sort-icon: #00ffff;
  --badge-bg: rgba(0, 255, 255, 0.2);
  --tag-bg: rgba(136, 61, 255, 0.2);
  --progress-bg: rgba(0, 255, 255, 0.1);
  --progress-bar-bg: linear-gradient(90deg, #00ffff, #883dff);
}

/* Table Component */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--text-primary);
  background: var(--table-bg);
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: middle;
  border-top: 1px solid var(--table-border);
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--table-border);
  background: var(--table-header-bg);
  color: var(--primary-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

/* Table Variants */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--table-stripe-bg);
}

.table-bordered {
  border: 1px solid var(--table-border);
}

.table-bordered th,
.table-bordered td {
  border: 1px solid var(--table-border);
}

.table-hover tbody tr {
  transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
  background-color: var(--table-hover-bg);
  cursor: pointer;
}

/* Table Sizes */
.table-sm th,
.table-sm td {
  padding: 0.3rem;
}

.table-lg th,
.table-lg td {
  padding: 1rem;
}

/* Responsive Table */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
  margin-bottom: 0;
}

/* Sortable Tables */
.table-sortable th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem;
}

.table-sortable th::after {
  content: "⇅";
  position: absolute;
  right: 0.5rem;
  color: var(--table-sort-icon);
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.table-sortable th:hover::after {
  opacity: 0.7;
}

.table-sortable th.sort-asc::after {
  content: "↑";
  opacity: 1;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.table-sortable th.sort-desc::after {
  content: "↓";
  opacity: 1;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Data Grid */
.data-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.data-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.data-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.data-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .data-grid-2,
  .data-grid-3,
  .data-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* List Component */
.list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.list-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--table-border);
  transition: background-color 0.2s ease;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--table-hover-bg);
}

.list-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Timeline Component */
.timeline {
  position: relative;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 2rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--table-border);
}

.timeline-item {
  position: relative;
  padding-left: 5rem;
  padding-bottom: 2rem;
}

.timeline-marker {
  position: absolute;
  left: 1.25rem;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--primary-color);
  border: 3px solid var(--bg-secondary);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.timeline-content {
  background: var(--table-header-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--table-border);
}

.timeline-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Accordion Component */
.accordion {
  margin-bottom: 1rem;
}

.accordion-item {
  background: var(--table-bg);
  border: 1px solid var(--table-border);
  margin-bottom: 0.5rem;
  border-radius: 8px;
  overflow: hidden;
}

.accordion-header {
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.accordion-header:hover {
  background: var(--table-hover-bg);
}

.accordion-header::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--primary-color);
  transition: transform 0.3s ease;
}

.accordion-item.active .accordion-header::after {
  transform: rotate(45deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-body {
  max-height: 1000px;
}

.accordion-content {
  padding: 0 1rem 1rem 1rem;
}

/* Tooltip Component */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: var(--text-primary);
  text-align: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--primary-color) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Badge Component */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  background: var(--badge-bg);
  color: var(--primary-color);
  border: 1px solid rgba(0, 255, 255, 0.3);
}

.badge-primary {
  background: rgba(0, 255, 255, 0.2);
  color: #00ffff;
  border-color: #00ffff;
}

.badge-secondary {
  background: rgba(136, 61, 255, 0.2);
  color: #883dff;
  border-color: #883dff;
}

.badge-success {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border-color: #28a745;
}

.badge-danger {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border-color: #dc3545;
}

.badge-warning {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border-color: #ffc107;
}

.badge-pill {
  padding-right: 0.6rem;
  padding-left: 0.6rem;
  border-radius: 10rem;
}

/* Tag Component */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  background: var(--tag-bg);
  color: var(--secondary-color);
  border-radius: 1rem;
  margin: 0.25rem;
  transition: all 0.2s ease;
}

.tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(136, 61, 255, 0.3);
}

.tag-remove {
  margin-left: 0.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.tag-remove:hover {
  opacity: 1;
}

/* Progress Bar */
.progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  font-size: 0.75rem;
  background-color: var(--progress-bg);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--table-border);
}

.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #000;
  text-align: center;
  white-space: nowrap;
  background: var(--progress-bar-bg);
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
  from { background-position: 1rem 0; }
  to { background-position: 0 0; }
}

/* Circular Progress */
.progress-circle {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle-bg {
  fill: none;
  stroke: var(--progress-bg);
  stroke-width: 10;
}

.progress-circle-bar {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
}

.progress-circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, 
    rgba(0, 255, 255, 0.05) 25%, 
    rgba(0, 255, 255, 0.1) 50%, 
    rgba(0, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.skeleton-title {
  height: 2rem;
  margin-bottom: 1rem;
  width: 50%;
}

.skeleton-card {
  height: 200px;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--primary-color);
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state-text {
  margin-bottom: 1.5rem;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 2rem;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--danger-color);
  border-radius: 8px;
  color: var(--danger-color);
}

.error-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .table {
    font-size: 0.875rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
  }
  
  .timeline {
    padding-left: 0;
  }
  
  .timeline::before {
    left: 0.5rem;
  }
  
  .timeline-item {
    padding-left: 2.5rem;
  }
  
  .timeline-marker {
    left: -0.25rem;
  }
}