/* ==========================================================================
   ذَرّة | ZARRA — Atom Builder Simulator Styles
   أنماط محاكي بناء الذرات الأولى للمبتدئين (البروتونات والنيوترونات والإلكترونات)
   ========================================================================== */

.atom-builder-layout {
  display: grid;
  grid-template-columns: 340px 1fr 300px;
  gap: var(--spacing-lg);
  align-items: start;
}

/* --------------------------------------------------------------------------
   1. بطاقة رصيد الجسيمات ومستودع السحب والتحكم (Particles Tray)
   -------------------------------------------------------------------------- */
.particle-tray-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.particle-control-group {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-soft);
}

.particle-control-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.particle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.particle-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.particle-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.dot-proton {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.dot-neutron {
  background: #64748b;
  box-shadow: 0 0 10px rgba(100, 116, 139, 0.3);
}

.dot-electron {
  background: #0284c7;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

.particle-count-badge {
  font-family: var(--font-chem-code);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text-main);
}

.particle-buttons {
  display: flex;
  gap: 6px;
}

.btn-particle-adj {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-medium);
  background: var(--color-bg-surface-soft);
  color: var(--color-text-main);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-particle-adj:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.btn-particle-adj:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   2. مساحة المحاكاة البصرية المركزية (Central Atom Arena)
   -------------------------------------------------------------------------- */
.atom-arena-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-height: 480px;
}

.atom-canvas-wrap {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--spacing-md) 0;
}

.atom-orbit-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.orbit-line {
  fill: none;
  stroke: var(--color-border-medium);
  stroke-dasharray: 4 4;
  transition: stroke 0.3s ease;
}

.orbit-line.active {
  stroke: rgba(2, 132, 199, 0.4);
}

.nucleus-glow-zone {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, rgba(100, 116, 139, 0.05) 70%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* حالة الاستقرار والشحنة */
.atom-status-row {
  display: flex;
  gap: var(--spacing-md);
  width: 100%;
  justify-content: center;
  margin-top: var(--spacing-sm);
  flex-wrap: wrap;
}

.atom-status-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border-soft);
  background: var(--color-bg-surface-soft);
}

.status-neutral {
  border-color: var(--color-mint-dark);
  color: var(--color-mint-dark);
  background: rgba(184, 216, 194, 0.2);
}

.status-positive {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.status-negative {
  border-color: #0284c7;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
}

.status-stable {
  border-color: var(--color-mint-dark);
  color: var(--color-mint-dark);
}

.status-unstable {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

/* --------------------------------------------------------------------------
   3. لوحة الهوية ومعلومات العنصر الحية (Live Element Tile HUD)
   -------------------------------------------------------------------------- */
.atom-hud-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.hud-tile {
  width: 140px;
  height: 140px;
  margin: 0 auto var(--spacing-md) auto;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-primary);
  background: linear-gradient(135deg, var(--color-bg-surface-soft), var(--color-bg-surface));
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: all 0.3s ease;
}

.hud-tile-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-chem-code);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.hud-tile-symbol {
  font-family: var(--font-chem-code);
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-primary);
  text-align: center;
  line-height: 1;
}

.hud-tile-name {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--font-size-xs);
  margin-top: var(--spacing-md);
}

.hud-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--color-bg-surface-soft);
  border: 1px solid var(--color-border-soft);
}

.hud-stat-label {
  color: var(--color-text-muted);
  font-weight: 600;
}

.hud-stat-value {
  font-family: var(--font-chem-code);
  font-weight: 800;
  color: var(--color-text-main);
}

/* بطاقة التحدي للمبتدئين */
.atom-challenge-box {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(233, 75, 103, 0.08), rgba(255, 217, 106, 0.12));
  border: 1.5px dashed var(--color-primary);
}

@media (max-width: 1100px) {
  .atom-builder-layout {
    grid-template-columns: 1fr 1fr;
  }
  .atom-arena-card {
    grid-column: span 2;
    order: -1;
  }
}

@media (max-width: 768px) {
  .atom-builder-layout {
    grid-template-columns: 1fr;
  }
  .atom-arena-card {
    grid-column: span 1;
  }
}
