/* ============================================
   Dataset Cards - Complete Redesign
   Mini tables, row counts, chart integration
   ============================================ */

.datasets-loading,
.datasets-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted, #666);
  font-size: 0.875rem;
}

.datasets-hint {
  font-size: 0.75rem;
  color: var(--text-light, #999);
  margin-top: 0.5rem;
}

/* ============================================
   DATASET CARD
   ============================================ */
.dataset-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  padding: 1rem;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}

.dataset-card {
  position: relative;
}

.dataset-card:hover {
  border-color: rgba(96,165,250,0.6);
  box-shadow: 0 16px 38px rgba(96,165,250,0.18);
  transform: translateY(-2px);
}

.dataset-card.active {
  border-color: rgba(96,165,250,0.9);
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(17,24,39,0.8));
  box-shadow: 0 18px 40px rgba(59,130,246,0.28);
}

/* ============================================
   CARD HEADER
   ============================================ */
.dataset-card-header {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.5rem;
}

.dataset-card-title {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.dataset-badges {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  flex-wrap: wrap;
}

.dataset-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dataset-badge {
  padding: 0.25rem 0.5rem;
  background: var(--primary, #0066cc);
  color: #ffffff;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.dataset-badge.active {
  background: var(--success, #28a745);
}

.dataset-badge.quality {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-weight: 600;
}

.dataset-badge.quality.quality-excellent {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
}

.dataset-badge.quality.quality-good {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

.dataset-badge.quality.quality-fair {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.dataset-badge.quality.quality-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.dataset-badge.status {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
}

.dataset-badge.status.status-fresh {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

.dataset-badge.status.status-recent {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

.dataset-badge.status.status-stale {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

.dataset-card-meta {
  display: grid;
  grid-auto-flow: column;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: #94a3b8;
}

.dataset-format {
  padding: 0.125rem 0.5rem;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.dataset-rows {
  font-weight: 600;
  color: #e2e8f0;
}

.dataset-cols {
  color: #94a3b8;
}

.dataset-size {
  color: #94a3b8;
  font-size: 0.75rem;
}

/* ============================================
   MINI TABLE PREVIEW
   ============================================ */
.dataset-preview-table {
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  background: #0b1220;
  max-height: 120px;
  overflow-y: auto;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.mini-table thead {
  position: sticky;
  top: 0;
  background: #0f172a;
  z-index: 1;
  border-bottom: 2px solid rgba(255,255,255,0.06);
}

.mini-table th {
  padding: 0.5rem 0.375rem;
  text-align: left;
  font-weight: 600;
  color: #e5e7eb;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 80px;
}

.mini-table td {
  padding: 0.375rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 80px;
}

.mini-table tbody tr:hover {
  background: rgba(96,165,250,0.08);
}

.mini-table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   CARD ACTIONS
   ============================================ */
.dataset-card-actions {
  display: grid;
  grid-auto-flow: column;
  gap: 0.5rem;
  justify-content: start;
}

.btn-dataset-action {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: grid;
  grid-auto-flow: column;
  gap: 0.25rem;
  align-items: center;
}

.btn-dataset-action:hover {
  background: #0f172a;
  border-color: rgba(255,255,255,0.14);
}

.btn-dataset-action.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  border-color: rgba(59,130,246,0.8);
}

.btn-dataset-action.primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(37,99,235,0.9);
}

.btn-dataset-action.profile {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #ffffff;
  border-color: rgba(6,182,212,0.85);
}

.btn-dataset-action.profile:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  border-color: rgba(8,145,178,0.9);
}

.btn-dataset-action.chart {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #ffffff;
  border-color: rgba(168,85,247,0.85);
}

.btn-dataset-action.chart:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border-color: rgba(124,58,237,0.9);
}

.btn-dataset-action.delete {
  background: transparent;
  border-color: transparent;
  color: var(--error, #dc3545);
  padding: 0.5rem;
}

.btn-dataset-action.delete:hover {
  background: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.45);
}

/* ============================================
   SIDEBAR SPECIFIC STYLES
   ============================================ */
#datasetsList .dataset-card {
  margin-bottom: 0.5rem;
}

#datasetsList .dataset-preview-table {
  max-height: 100px;
}

#datasetsList .mini-table {
  font-size: 0.6875rem;
}

#datasetsList .mini-table th,
#datasetsList .mini-table td {
  padding: 0.25rem 0.375rem;
  max-width: 60px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .dataset-card {
    padding: 0.75rem;
  }
  
  .dataset-card-actions {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }
  
  .btn-dataset-action {
    width: 100%;
    justify-content: center;
  }
  
  .mini-table {
    font-size: 0.6875rem;
  }
  
  .mini-table th,
  .mini-table td {
    max-width: 50px;
    padding: 0.25rem;
  }
}

