/* ═══════════════════════════════════════
   COMPONENTS — All UI Components
   ═══════════════════════════════════════ */

/* ── Control Groups ── */
.control-group {
  margin-bottom: var(--sp-4);
}

.control-group > label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--sp-2);
}

/* ── Buttons ── */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.btn-toggle {
  flex: 1;
  min-width: 0;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-toggle:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
}

.btn-toggle.active {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.3);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-sm:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.btn-sm.active {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
}

.btn-sm.btn-danger {
  color: var(--accent-red);
}
.btn-sm.btn-danger:hover {
  background: rgba(255, 107, 107, 0.15);
}

.btn-primary {
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}
.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 12px rgba(0,229,255,0.3);
}

/* ── Range Inputs ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  margin: var(--sp-2) 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,229,255,0.4);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Checkboxes ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--bg-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── Select / Dropdown ── */
select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  padding-right: 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-family: var(--font-primary);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899bb' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--transition-fast);
}

select:hover {
  border-color: rgba(100,160,255,0.3);
  background-color: rgba(255,255,255,0.08);
}

select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0,229,255,0.15);
}

select option {
  background: #0a0e1a;
  color: var(--text-primary);
  padding: 8px;
}

/* Narrow selects (inside transition calc etc.) */
.transition-row select {
  width: 60px;
  padding-right: 24px;
  background-position: right 6px center;
}

/* ── Excitation Controls ── */
.excitation-controls {
  display: flex;
  gap: var(--sp-1);
}

/* ── Info Cards ── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.info-card h3 {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-color);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.info-value {
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}

.config-text {
  font-size: var(--fs-xs);
  word-break: break-all;
}

/* ── Electron Table ── */
.electron-table-wrapper {
  max-height: 200px;
  overflow-y: auto;
}

.electron-table {
  width: 100%;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}

.electron-table th {
  padding: var(--sp-1) var(--sp-2);
  text-align: center;
  font-weight: 600;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.electron-table td {
  padding: var(--sp-1) var(--sp-2);
  text-align: center;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.electron-table tr:hover td {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  cursor: pointer;
}

.electron-table tr.selected td {
  background: rgba(0, 180, 255, 0.15);
  color: #fff;
  border-bottom-color: rgba(0, 180, 255, 0.3);
}

.electron-table .orbital-label {
  color: var(--accent-cyan);
  text-align: left;
}

/* ── Wavefunction Canvas ── */
#wavefunction-canvas {
  width: 100%;
  height: 160px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  margin-bottom: var(--sp-2);
}

.wf-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.wf-info span:nth-child(even) {
  color: var(--text-primary);
  margin-right: var(--sp-2);
}

/* ── Transition Calculator ── */
.transition-calc {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.transition-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.transition-row label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.transition-row select {
  width: 60px;
}

.transition-result {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: var(--sp-2);
}

.measure-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  padding: 2px 0;
}

.measure-row span:first-child {
  color: var(--text-muted);
}

.color-swatch {
  display: inline-block;
  width: 40px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
  vertical-align: middle;
}

/* ── Measurement Overlay ── */
.measurement-overlay {
  position: absolute;
  background: rgba(0,0,0,0.75);
  border: 1px solid var(--border-glow);
  border-radius: var(--border-radius);
  padding: var(--sp-2) var(--sp-3);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-glow);
  pointer-events: none;
  z-index: var(--z-overlay);
}

/* ── Atom Loading Overlay ── */
.atom-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 8, 0.6);
  z-index: 100;
  backdrop-filter: blur(2px);
  transition: opacity 0.25s ease;
}

.atom-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(100, 255, 218, 0.15);
  border-top-color: var(--accent-cyan, #64ffda);
  border-radius: 50%;
  animation: atom-spin 0.7s linear infinite;
}

@keyframes atom-spin {
  to { transform: rotate(360deg); }
}

/* ── Mobile Info Overlay (Language + Element) ── */
.mobile-info-overlay {
  display: none;
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: 15;
  gap: var(--sp-2);
  flex-direction: column;
  align-items: flex-end;
}

[dir="rtl"] .mobile-info-overlay {
  right: auto;
  left: var(--sp-3);
  align-items: flex-start;
}

.mobile-element-display {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(3, 3, 8, 0.85);
  backdrop-filter: blur(12px);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--border-radius);
  border: 1px solid rgba(100, 255, 218, 0.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: fadeSlideIn 0.3s ease;
}

.mobile-element-symbol {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1;
}

.mobile-element-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-element-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.mobile-element-z {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  line-height: 1;
}

.mobile-language-switcher {
  display: flex;
  gap: 4px;
  background: rgba(3, 3, 8, 0.85);
  backdrop-filter: blur(12px);
  padding: 4px;
  border-radius: var(--border-radius);
  border: 1px solid rgba(100, 255, 218, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: fadeSlideIn 0.3s ease 0.1s backwards;
}

.mobile-lang-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 4px;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  cursor: pointer;
}

.mobile-lang-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

.mobile-lang-btn.active {
  color: var(--bg-primary);
  background: var(--accent-cyan);
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Periodic Table Elements ── */
/* (Styles now in layout.css under .pt-element) */
