/* ==========================================================================
   Phase diagram page — periodic table + diagram renderer
   ========================================================================== */

/* --- Periodic table grid ------------------------------------------------ */

.pd-page-card {
  background: var(--card-bg, #ecebf2);
}

.pd-periodic-table {
  margin: 24px 0;
}

.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 2px;
  max-width: 720px;
  margin: 0 auto;
}

.pt-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid #d8d6e0;
  background: #e1e0e8;
  color: #1a1d3a;
  cursor: pointer;
  padding: 2px;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.pt-cell:hover {
  background: #d4d3dc;
  border-color: #b8b6c0;
}

.pt-num {
  font-size: 7px;
  opacity: 0.4;
  line-height: 1;
}

.pt-sym {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.pt-cell.pt-selected {
  background: #2a2f7c;
  border-color: #2a2f7c;
  color: #fff;
}

.pt-cell.pt-available {
  background: rgba(42, 47, 124, 0.1);
  border-color: rgba(42, 47, 124, 0.35);
  color: #2a2f7c;
}

.pt-cell.pt-available:hover {
  background: rgba(42, 47, 124, 0.18);
  border-color: #2a2f7c;
}

.pt-cell.pt-unavailable {
  opacity: 0.25;
  cursor: default;
}

.pt-cell.pt-unavailable:hover {
  background: #f6f5fa;
  border-color: #e0dfe6;
}

.pt-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0.3;
  color: #3a3d5a;
}

/* --- Stable/metastable toggle ------------------------------------------- */

.pd-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 8px 0 12px;
}

.pd-toggle-btn {
  padding: 6px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #c8c6d0;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.pd-toggle-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.pd-toggle-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.pd-toggle-btn.pd-toggle-active {
  background: #2a2f7c;
  color: #fff;
  border-color: #2a2f7c;
}

.pd-toggle-btn:hover:not(.pd-toggle-active) {
  border-color: #2a2f7c;
  color: #2a2f7c;
}

/* --- Phase diagram renderer --------------------------------------------- */

.pd-diagram-container {
  margin: 24px 0;
  background: #e1e0e8;
  padding: 16px;
}

.pd-header {
  text-align: center;
  margin-bottom: 12px;
}

.pd-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a1d3a;
  margin: 0;
}

.pd-flip-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: rgba(255,255,255,0.8);
  border: 1px solid #c8c6d0;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 10px;
  color: #666;
  transition: all 0.15s;
}

.pd-flip-btn:hover {
  border-color: #2a2f7c;
  color: #2a2f7c;
  background: #fff;
}

.pd-ref {
  font-size: 11px;
  color: #888;
  margin: 4px 0 0;
}

.pd-canvas {
  border-radius: 0;
}

.pd-info {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #666;
  margin-top: 8px;
  padding-top: 8px;
}

.pd-info b {
  color: #1a1d3a;
}

.pd-hint {
  opacity: 0.4;
}

.pd-snap-label {
  font-weight: 600;
  font-size: 11px;
}

.pd-loading {
  text-align: center;
  color: #888;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 40px 0;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 600px) {
  .pt-sym { font-size: 9px; }
  .pt-num { font-size: 6px; }
  .pt-grid { gap: 1px; }
}
