/* ════════════════════════════════════════════════════════
   MODULE TABLES & LISTINGS - Professional styling
   ════════════════════════════════════════════════════════ */

/* Container layout */
.modules-section {
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.module-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin-bottom: 32px;
}

.module-header {
  background: linear-gradient(135deg, #1a1f3c 0%, #2d3561 100%);
  color: white;
  padding: 20px 24px;
  border-bottom: 3px solid #4a8cf4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.count-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.module-body {
  padding: 0;
}

.capability-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 16px 20px 4px;
}
.capability-toolbar label { color: var(--text-secondary, #64748b); font-size: .76rem; font-weight: 600; }
.capability-toolbar .form-input { min-width: 170px; flex: 1 1 180px; }
.capability-toolbar #capabilityDomain { flex-basis: 150px; }
.capability-toolbar .btn { min-height: 44px; }
.capability-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; padding: 16px 20px 24px; }
.capability-card { border: 1px solid var(--border-light, #e2e8f0); border-radius: 12px; padding: 16px; background: var(--bg-secondary, #fff); box-shadow: 0 4px 14px rgba(15,23,42,.05); }
.capability-card-head, .capability-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.capability-domain, .capability-source { color: var(--text-muted, #64748b); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.capability-status { border-radius: 999px; padding: 3px 8px; font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.capability-status-available { color: #047857; background: #d1fae5; }
.capability-status-planned { color: #92400e; background: #fef3c7; }
.capability-status-degraded { color: #b91c1c; background: #fee2e2; }
.capability-card h4 { margin: 13px 0 8px; font-size: 1rem; }
.capability-card h4 .text-cn { display: block; margin-top: 3px; font-size: .75rem; color: var(--text-muted, #64748b); font-weight: 500; }
.capability-owner, .capability-health, .capability-deps { margin: 6px 0; color: var(--text-secondary, #475569); font-size: .78rem; line-height: 1.45; }
.capability-card-actions { margin-top: 14px; align-items: flex-end; }
.capability-planned-note { color: var(--text-muted, #64748b); font-size: .72rem; }
.capability-source { max-width: 48%; text-align: right; overflow-wrap: anywhere; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table th {
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
}

.data-table tbody tr {
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

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

.data-table tbody tr.selected {
  background: #eff6ff;
  border-left: 4px solid #4a8cf4;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.done {
  background: #dcfce7;
  color: #166534;
}

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

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

/* Risk level badges */
.risk-level {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  min-width: 80px;
}

.risk-critical { background: #fee2e2; color: #991b1b; }
.risk-high { background: #ffedd5; color: #9a3412; }
.risk-medium { background: #fefce8; color: #854d0e; }
.risk-low { background: #dcfce7; color: #166534; }

/* Priority indicator */
.priority-high { color: #dc2626; font-weight: bold; }
.priority-medium { color: #ca8a04; font-weight: 600; }
.priority-low { color: #16a34a; font-weight: 600; }

/* Column widths */
.col-date { width: 120px; }
.col-status { width: 100px; }
.col-priority { width: 100px; }
.col-risk { width: 120px; }
.col-amount { width: 120px; }
.col-actions { width: 80px; }

/* Numeric columns */
.text-right { text-align: right; }
.text-center { text-align: center; }

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

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

.empty-state-text {
  font-size: 16px;
  font-weight: 500;
}

/* Skeleton loaders */
.skeleton-row {
  animation: skeleton-loading 1.5s infinite;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive design */
@media (max-width: 1024px) {
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  .module-card {
    margin-bottom: 24px;
  }
}

@media (max-width: 768px) {
  .modules-section {
    padding: 0 16px;
  }
  
  .module-header {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .count-badge {
    position: static;
  }
  
  .col-date { width: 100px; }
}

/* Hover effects for interactive rows */
.interactive-row {
  position: relative;
}

.interactive-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 2px;
  background: #4a8cf4;
  transition: width 0.3s ease;
}

.interactive-row:hover::before {
  width: 4px;
}

/* Selection states */
.selection-mode .interactive-row.selected {
  background: #eff6ff !important;
}

/* Loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #4a8cf4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 32px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
