/* Linux BenchTools - Memory Slots Visualization */

/* Container pour tous les slots mémoire */
.memory-slots-container {
  margin-top: 1.5rem;
}

.memory-slots-header {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.memory-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
  overflow-x: hidden;
}

/* Style pour un slot mémoire individuel */
.memory-slot {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.memory-slot::before {
  content: none;
}

.memory-slot:hover {
  border-color: rgba(76, 175, 80, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.memory-slot:hover::before {
  opacity: 0;
}

/* Slot occupé */
.memory-slot.occupied {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, var(--bg-tertiary) 100%);
  border-color: rgba(76, 175, 80, 0.3);
}

.memory-slot.occupied::before {
  background: var(--color-success);
  opacity: 1;
}

.memory-slot.occupied:hover {
  border-color: var(--color-success);
}

/* Slot vide */
.memory-slot.empty {
  background: linear-gradient(135deg, rgba(158, 158, 158, 0.05) 0%, var(--bg-secondary) 100%);
  border-style: dashed;
  border-color: rgba(158, 158, 158, 0.3);
  opacity: 0.7;
}

.memory-slot.empty::before {
  background: var(--text-muted);
  opacity: 0.3;
}

.memory-slot.empty:hover {
  opacity: 1;
  border-color: rgba(158, 158, 158, 0.5);
}

/* En-tête du slot (nom du slot) */
.memory-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.memory-slot-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.memory-slot.empty .memory-slot-name {
  color: var(--text-muted);
}

.memory-slot-icon {
  font-size: 1.2rem;
}

.memory-slot-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.memory-slot-status.occupied {
  background: rgba(76, 175, 80, 0.2);
  color: var(--color-success);
}

.memory-slot-status.empty {
  background: rgba(158, 158, 158, 0.2);
  color: var(--text-muted);
}

/* Corps du slot (caractéristiques) */
.memory-slot-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.memory-slot-size {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
  line-height: 1.1;
}

.memory-slot.empty .memory-slot-size {
  color: var(--text-muted);
  font-size: 1.2rem;
}

.memory-slot-spec {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.memory-slot-spec-label {
  color: var(--text-secondary);
  min-width: 85px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.memory-slot-spec-value {
  color: var(--text-primary);
  font-weight: 600;
  flex: 1;
}

.memory-slot.empty .memory-slot-spec-value {
  color: var(--text-muted);
}

/* Nouvelles classes pour affichage compact sur plusieurs lignes */
.memory-slot-spec-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.memory-slot-spec-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.memory-slot-spec-inline .memory-slot-spec-label {
  min-width: auto;
  font-size: 0.85rem;
}

.memory-slot-spec-inline .memory-slot-spec-value {
  font-size: 0.85rem;
}

/* Highlight pour la fréquence */
.memory-slot-spec:has(.memory-slot-spec-label:contains('Fréquence')) {
  background: rgba(var(--color-primary-rgb, 33, 150, 243), 0.05);
  padding: 0.5rem;
  border-radius: 6px;
  margin: 0.25rem 0;
}

/* Badge pour le type de RAM */
.memory-type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--color-primary);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.memory-type-badge.ddr3 {
  background: linear-gradient(135deg, #2196F3, #1976D2);
}

.memory-type-badge.ddr4 {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
}

.memory-type-badge.ddr5 {
  background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.memory-type-badge.unknown {
  background: linear-gradient(135deg, #757575, #616161);
}

/* Icône du fabricant */
.memory-manufacturer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.memory-manufacturer-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
}

.memory-manufacturer-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Légende */
.memory-slots-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.85rem;
}

.memory-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.memory-legend-indicator {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.memory-legend-indicator.occupied {
  background: var(--color-success);
  border: 2px solid rgba(76, 175, 80, 0.3);
}

.memory-legend-indicator.empty {
  background: transparent;
  border: 2px dashed rgba(158, 158, 158, 0.5);
}

/* Memory usage bar */
.memory-usage {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
}

.memory-usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.memory-usage-title {
  font-weight: 700;
  color: var(--text-primary);
}

.memory-bar {
  display: flex;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  height: 46px;
}

.memory-bar-labels {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.memory-bar-label {
  display: flex;
  justify-content: center;
  color: var(--text-secondary);
}

.memory-bar-label.used {
  color: var(--color-success);
}

.memory-bar-label.shared {
  color: var(--color-warning);
}

.memory-bar-label.free {
  color: var(--text-secondary);
}

.memory-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bg-primary);
  transition: width 0.3s ease;
}

.memory-bar-segment.used {
  background: var(--color-success);
}

.memory-bar-segment.shared {
  background: var(--color-warning);
}

.memory-bar-segment.free {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.memory-bar-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.memory-slot-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.memory-slot-name {
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.memory-slot-size {
  font-weight: 700;
  color: var(--color-info);
}

.memory-slot-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.memory-slot-chip {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.memory-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.memory-slot-grid-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.memory-slot-grid-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
}

.memory-slot-meta {
  display: grid;
  gap: 0.35rem;
}

.memory-slot-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.memory-slot-meta-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.memory-slot-meta-small {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.memory-slot-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-secondary);
  border: 2px solid var(--color-success);
  border-radius: 10px;
  padding: 0.75rem;
  width: 260px;
  max-width: 300px;
  color: var(--text-primary);
  font-size: 0.72rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(76, 175, 80, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 2000;
  backdrop-filter: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.memory-slot:hover .memory-slot-tooltip {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease 0.1s, visibility 0.2s ease 0.1s;
}

.memory-slot-tooltip-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-success);
  font-size: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border-color);
}

.memory-slot-tooltip-row {
  display: grid;
  grid-template-columns: minmax(min(90px, 100%), auto) 1fr;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.72rem;
}

.memory-slot-tooltip-row:last-child {
  border-bottom: none;
}

.memory-slot-tooltip-row strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.memory-slot-tooltip-row span {
  color: var(--text-primary);
  font-weight: 700;
}

/* DMI memory details */
.memory-dmi {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.memory-dmi-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem;
}

.memory-dmi-title {
  margin-bottom: 0.5rem;
  color: var(--color-info);
  font-size: 0.9rem;
}

.memory-dmi-fields {
  display: grid;
  gap: 0.35rem;
}

.memory-dmi-line {
  display: grid;
  grid-template-columns: minmax(min(160px, 100%), min(220px, 100%)) 1fr;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.memory-dmi-line strong {
  color: var(--text-primary);
}

/* Tooltip content */
.memory-tooltip-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.memory-tooltip-line {
  color: var(--text-secondary);
}

/* Vue responsive */
@media (max-width: 768px) {
  .memory-slots-grid {
    grid-template-columns: 1fr;
  }

  .memory-slots-legend {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 640px) {
  .memory-bar {
    height: 38px;
  }

  .memory-bar-segment {
    font-size: 0.75rem;
  }

  .memory-dmi-line {
    grid-template-columns: 1fr;
  }
}

/* Animation au chargement */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.memory-slot {
  animation: slideInUp 0.3s ease-out;
}

.memory-slot:nth-child(1) { animation-delay: 0.05s; }
.memory-slot:nth-child(2) { animation-delay: 0.1s; }
.memory-slot:nth-child(3) { animation-delay: 0.15s; }
.memory-slot:nth-child(4) { animation-delay: 0.2s; }
.memory-slot:nth-child(5) { animation-delay: 0.25s; }
.memory-slot:nth-child(6) { animation-delay: 0.3s; }
.memory-slot:nth-child(7) { animation-delay: 0.35s; }
.memory-slot:nth-child(8) { animation-delay: 0.4s; }

/* Fixed tooltip panel on the right side of grid */
.memory-tooltip-panel {
  position: absolute;
  right: -330px;
  top: 0;
  min-width: 280px;
  max-width: 320px;
  width: 300px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.memory-tooltip-panel.active {
  opacity: 1;
  visibility: visible;
  border-color: var(--color-success);
}

.memory-tooltip-content {
  color: var(--text-primary);
  font-size: 0.72rem;
  line-height: 1.4;
}

.memory-tooltip-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

/* Wrapper for grid + panel - needs position relative for absolute panel */
.memory-slots-container > div[style*="display: flex"] {
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Responsive: hide panel on small screens */
@media (max-width: 1024px) {
  .memory-tooltip-panel {
    display: none;
  }
}
