/* Chemistry tab panel styling — Phase 5C-1 */

/* ═══════════════════════════════════════
   Colour declarations
   ═══════════════════════════════════════ */

@media print {
  .chemistry-structure {
    border-color: #ccc;
  }
}

/* ═══════════════════════════════════════
   Layout & typography
   ═══════════════════════════════════════ */

/* Structure diagram */
.chemistry-structure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 1rem 0;
  padding: 1rem;
  border: 1px solid;
  border-radius: 0.5rem;
}

.chemistry-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

/* Phase 7C-2: Rendering preset selector */
.chemistry-preset-selector {
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}

.chemistry-preset-legend {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.25rem;
}

.chemistry-preset-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* Phase 7C-5: per-image toggle lifted up next to the preset radio group */
.chemistry-per-image-toggle-group {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed currentColor;
  font-size: 0.8rem;
}

.chemistry-per-image-toggle-group .chemistry-control-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.chemistry-preset-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.15rem 0;
}

.chemistry-preset-label input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.chemistry-preset-label input[type="radio"]:focus-visible {
  outline: 2px solid #005c84;
  outline-offset: 2px;
}

.chemistry-preset-text {
  user-select: none;
}

/* Phase 7C-3: Advanced rendering controls */
.chemistry-advanced-controls {
  margin: 0.25rem 0 0.5rem;
}

.chemistry-advanced-summary {
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0;
  user-select: none;
}



.chemistry-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.chemistry-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chemistry-control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
}

.chemistry-control-value {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 2rem;
  text-align: right;
}

.chemistry-control-range {
  width: 100%;
  cursor: pointer;
}

.chemistry-control-range:focus-visible {
  outline: 2px solid #005c84;
  outline-offset: 2px;
}

.chemistry-control-checkbox-group {
  flex-direction: row;
}

.chemistry-control-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.chemistry-control-checkbox {
  margin: 0;
  cursor: pointer;
}

.chemistry-control-checkbox:focus-visible {
  outline: 2px solid #005c84;
  outline-offset: 2px;
}

.chemistry-control-select {
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}

.chemistry-control-select:focus-visible {
  outline: 2px solid #005c84;
  outline-offset: 2px;
}

.chemistry-control-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

/* Identifiers data list */
.chemistry-identifiers {
  margin-bottom: 1rem;
}

.chemistry-section-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid;
}

.chemistry-data-list {
  margin: 0;
  padding: 0;
}

.chemistry-data-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid;
  align-items: baseline;
}

.chemistry-data-row dt {
  flex: 0 0 auto;
  min-width: 8rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.chemistry-data-row dd {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
}

.chemistry-value {
  display: inline-block;
  word-break: break-all;
}

.chemistry-code {
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 0.2rem;
}

/* PubChem lookup states (Phase 5D-2) */
.chemistry-not-found {
  font-size: 0.85rem;
}

.chemistry-iupac-secondary {
  font-size: 0.85rem;
}

/* Description area */
.chemistry-description {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-left: 3px solid;
  border-radius: 0 0.25rem 0.25rem 0;
}

.chemistry-description-content {
  margin: 0;
  line-height: 1.5;
}

.chemistry-description-provenance {
  margin: 0.5rem 0 0 0;
  font-size: 0.8rem;
  font-style: italic;
}

/* Phase 6D: Copy Description button inside description area */
.chemistry-description .chemistry-action-btn {
  margin-top: 0.5rem;
}

/* Phase 7A-3: Structural description */
.chemistry-structural-desc {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--chem-border, #e0e0e0);
  font-size: 0.9rem;
  line-height: 1.4;
}

.chemistry-structural-desc p {
  margin: 0;
}

/* Phase 7B: Human-readable text description */
.captured-text-description {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-left: 3px solid var(--chem-border, #e0e0e0);
  background: var(--chem-panel-bg, #f9f9f9);
  border-radius: 0 4px 4px 0;
}

.captured-text-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.captured-text-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--chem-label, #555);
}

.captured-text-content {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Action buttons */
.chemistry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chemistry-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.chemistry-action-btn [data-icon] {
  width: 1em;
  height: 1em;
}

/* Structure selector (for multiple structures) */
.chemistry-structure-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.chemistry-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.chemistry-counter {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .chemistry-data-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .chemistry-data-row dt {
    min-width: unset;
  }

  .chemistry-actions {
    flex-direction: column;
  }

  .chemistry-action-btn {
    justify-content: center;
  }
}

/* Focus styles (Phase 6E — E1) */
.chemistry-action-btn:focus-visible,
.chemistry-nav-btn:focus-visible {
  outline: 2px solid #005c84;
  outline-offset: 2px;
}

/* Forced-colours support (Phase 6E — E6) */
@media (forced-colors: active) {
  .chemistry-action-btn,
  .chemistry-nav-btn {
    border: 1px solid ButtonText;
  }

  .chemistry-description {
    border-left-color: LinkText;
  }

  .chemistry-canvas {
    border: 1px solid CanvasText;
  }

  .chemistry-structure {
    border-color: CanvasText;
  }

  .chemistry-structural-desc {
    border-top-color: CanvasText;
  }

  .captured-text-description {
    border-left-color: LinkText;
  }

  .chemistry-preset-selector {
    border-color: CanvasText;
  }

  .chemistry-advanced-controls {
    border-color: CanvasText;
  }

  .chemistry-control-select {
    border-color: CanvasText;
  }

  /* Phase 7C-4: per-image badge */
  .chemistry-per-image-badge {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
  }
}

/* Phase 7C-4: per-image settings indicator badge */
.chemistry-per-image-badge {
  display: inline-flex;
  align-items: center;
  margin: 0.5rem 0 0.25rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--chem-border, #888);
  border-radius: 999px;
  background: var(--chem-bg, #f5f5f5);
  color: var(--text-color, inherit);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
}

.chemistry-per-image-badge[hidden] {
  display: none;
}

/* Phase 6E — E7: No transition animations exist in this file; rule intentionally omitted */

/* Print styles */
@media print {
  .chemistry-actions,
  .chemistry-structure-selector,
  .chemistry-preset-selector,
  .chemistry-advanced-controls,
  .chemistry-per-image-badge {
    display: none;
  }

  .chemistry-structure {
    border: 1px solid;
    break-inside: avoid;
  }
}
