/* ========================================
   PLOT GRID
   ======================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.8rem;
  padding: 1rem 0;
}

.grid-item {
  text-align: center;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 0.8rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.grid-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--border-color);
}

.grid-item img {
  max-width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.grid-item a {
  color: var(--link-color);
  text-decoration: none;
}

.grid-item.highlighted {
  border-color: var(--button-bg);
  box-shadow: 0 0 15px rgba(0, 120, 212, 0.3);
  transform: translateY(-2px);
  animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
  0%, 100% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.02); }
}

.plot-name {
  margin-top: 0.8rem;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  font-size: 0.9rem;
  line-height: 1.3;
  max-height: 3.9rem;
  overflow: hidden;
  padding: 0 0.2rem;
  font-weight: 500;
}

/* Plot selection mode */
.selecting-plots .grid-item {
  cursor: pointer !important;
  transition: all 0.2s ease;
  position: relative;
}

.selecting-plots .grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 120, 212, 0.3);
  border-color: var(--button-bg);
}

.selecting-plots .grid-item::before {
  content: '📊 Click to compare';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 120, 212, 0.95);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

.selecting-plots .grid-item:hover::before {
  opacity: 1;
}

/* Ensure grid items are clickable in selection mode */
.selecting-plots .grid-item * {
  pointer-events: none;
}

.selecting-plots .grid-item {
  pointer-events: auto;
}
