/* ============================================================
   Framework Mapping - Mapping Transversal
   ============================================================ */

/* Header & Selectors */
.mapping-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-surface-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}

.mapping-selectors {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.mapping-select {
  min-width: 160px;
  font-weight: 600;
}

.mapping-arrow {
  color: var(--color-text-light);
  font-size: var(--font-size-lg);
}

.mapping-filters {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.mapping-filter-select {
  min-width: 130px;
}

.mapping-search {
  min-width: 180px;
  max-width: 240px;
}

.mapping-view-toggle {
  display: flex;
  gap: var(--spacing-xs);
  margin-left: var(--spacing-xs);
}

.mapping-view-btn {
  opacity: 0.5;
  transition: opacity var(--transition-duration);
}

.mapping-view-btn:hover {
  opacity: 0.8;
}

.mapping-view-btn--active {
  opacity: 1;
  background: var(--color-primary);
  color: var(--color-surface);
}

/* Stats bar */
.mapping-stats {
  display: flex;
  gap: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  background: var(--color-surface-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.mapping-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.mapping-stat__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.mapping-stat__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
  text-align: center;
}

/* List view - Table */
.mapping-list {
  overflow-x: auto;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
}

.mapping-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-surface-secondary);
  padding: var(--spacing-sm) var(--spacing-sm);
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--color-border);
  z-index: 1;
}

.mapping-col-ref { width: 70px; }
.mapping-col-title { width: 30%; }
.mapping-col-status { width: 100px; }
.mapping-col-mappings { min-width: 300px; }

.mapping-row {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-duration);
}

.mapping-row:hover {
  background: var(--color-surface-secondary);
}

.mapping-row td {
  padding: var(--spacing-sm) var(--spacing-sm);
  vertical-align: top;
  font-size: var(--font-size-sm);
}

/* Status badges */
.mapping-status {
  display: inline-block;
  padding: 2px var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.status--non_implemente {
  background: var(--color-danger-light);
  color: var(--color-danger-dark);
}

.status--en_cours {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.status--implemente {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.status--verifie {
  background: var(--color-info-light);
  color: var(--color-info-dark);
}

/* Mapping badges (target controls) */
.mapping-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.mapping-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  transition: box-shadow var(--transition-duration);
  cursor: default;
}

.mapping-badge:hover {
  box-shadow: var(--shadow-sm);
}

.mapping-badge__ref {
  font-weight: 700;
  color: var(--color-text);
}

.mapping-badge__rel {
  color: var(--color-text-light);
  font-size: 0.74rem;
}

.mapping-badge__rel i {
  font-size: var(--font-size-xs);
}

.mapping-badge__cov {
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--color-text-light);
}

.mapping-badge__status {
  display: inline-flex;
  align-items: center;
}

.mapping-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--border-radius-full);
}

.mapping-empty {
  color: var(--color-text-light);
  font-style: italic;
  font-size: var(--font-size-sm);
}

.mapping-empty-row {
  text-align: center;
  padding: var(--spacing-xl) !important;
  color: var(--color-text-light);
}

/* Heatmap view */
.mapping-heatmap-container {
  overflow-x: auto;
  padding: var(--spacing-xs);
}

.mapping-heatmap {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mapping-heatmap__corner {
  width: 140px;
  background: var(--color-surface-secondary);
}

.mapping-heatmap__colhead {
  padding: var(--spacing-sm) var(--spacing-xs);
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-light);
  background: var(--color-surface-secondary);
  border-bottom: 2px solid var(--color-border);
  word-wrap: break-word;
}

.mapping-heatmap__rowhead {
  padding: var(--spacing-sm) var(--spacing-sm);
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-secondary);
  border-right: 2px solid var(--color-border);
  white-space: nowrap;
}

.mapping-heatmap__cell {
  padding: var(--spacing-sm) var(--spacing-xs);
  text-align: center;
  border: 1px solid var(--color-border);
  transition: transform var(--transition-duration);
  cursor: default;
  vertical-align: middle;
}

.mapping-heatmap__cell:hover {
  transform: scale(1.05);
  z-index: 1;
  box-shadow: var(--shadow-md);
}

.mapping-heatmap__count {
  display: block;
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.mapping-heatmap__cov {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

/* Responsive */
@media (max-width: 768px) {
  .mapping-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mapping-selectors,
  .mapping-filters {
    flex-wrap: wrap;
  }

  .mapping-stats {
    gap: var(--spacing-sm);
  }

  .mapping-stat {
    min-width: 70px;
  }

  .mapping-col-title {
    width: auto;
  }

  .mapping-col-mappings {
    min-width: 200px;
  }
}

/* Print styles */
@media print {
  .framework-mapping__toolbar,
  .framework-mapping__filters {
    display: none;
  }
  .framework-mapping__content {
    overflow: visible;
  }
}
