/* ==========================================================================
   ذَرّة | ZARRA — Chemical Bonding & Molecule Builder Styles
   المرحلة 4: باني الروابط والجزيئات الكيميائية
   ========================================================================== */

.bonding-workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--spacing-xl);
  align-items: start;
}

/* بطاقة اختيار نوع الرابطة والجزيء */
.bonding-sidebar {
  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);
}

.bonding-type-btn {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border-soft);
  background: var(--color-bg-surface-soft);
  color: var(--color-text-main);
  font-weight: 700;
  font-size: var(--font-size-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  transition: all var(--transition-fast);
}

.bonding-type-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-surface);
}

.bonding-type-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.molecule-preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--spacing-md);
}

.molecule-preset-btn {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-soft);
  background: var(--color-bg-surface);
  font-size: var(--font-size-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.molecule-preset-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateX(-2px);
}

.molecule-preset-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  font-weight: 700;
  color: var(--color-primary);
}

/* مساحة البناء والمحاكاة */
.bonding-canvas-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;
}

.bonding-stage-viewport {
  width: 100%;
  height: 380px;
  background: radial-gradient(circle at center, var(--color-bg-surface-soft) 0%, var(--color-bg-surface) 100%);
  border: 1.5px dashed var(--color-border-medium);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.bonding-atom-node {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bonding-atom-sym {
  font-size: 1.4rem;
  font-family: var(--font-chem-code);
}

.bonding-atom-charge {
  font-size: 0.75rem;
  font-family: var(--font-chem-code);
}

.bonding-bond-line {
  height: 6px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* بطاقة تركيب لويس وتفاصيل الرابطة */
.bonding-explanation-card {
  background: var(--color-bg-surface-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.lewis-structure-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  font-family: var(--font-chem-code);
  margin: var(--spacing-sm) 0;
  direction: ltr;
}

@media (max-width: 860px) {
  .bonding-workspace {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   أنماط الرابطة الفلزية وقوى التجاذب بين الجزيئات
   ========================================================================== */

/* الشبكة البلورية للرابطة الفلزية */
.metallic-lattice-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 28px;
  position: relative;
  padding: var(--spacing-lg);
  background: radial-gradient(ellipse at center, rgba(255, 217, 106, 0.15) 0%, transparent 70%);
  border-radius: var(--radius-xl);
}

.metallic-cation {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 170, 0, 0.6);
  border: 2px solid #fff;
  z-index: 2;
  position: relative;
}

.delocalized-electron-particle {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: #38BDF8;
  color: #0369A1;
  font-size: 0.65rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px #38BDF8;
  position: absolute;
  z-index: 3;
  animation: electronDrift 3s infinite ease-in-out alternate;
}

@keyframes electronDrift {
  0% { transform: translate(0, 0) scale(0.9); }
  50% { transform: translate(12px, -8px) scale(1.1); }
  100% { transform: translate(-10px, 14px) scale(1); }
}

/* قوى التجاذب بين الجزيئات (IMF) */
.imf-molecules-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  width: 100%;
  padding: var(--spacing-md);
}

.imf-molecule-unit {
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border-medium);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.dipole-badge {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-chem-code);
  padding: 2px 4px;
  border-radius: 4px;
}

.dipole-badge.delta-plus {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.dipole-badge.delta-minus {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.imf-dashed-bond-line {
  border-top: 3px dashed var(--color-primary);
  width: 50px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseIMF 2s infinite ease-in-out;
}

.imf-dashed-bond-label {
  position: absolute;
  top: -18px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  background: var(--color-bg-surface);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-soft);
}

@keyframes pulseIMF {
  0%, 100% { opacity: 0.7; transform: scaleX(0.95); }
  50% { opacity: 1; transform: scaleX(1.05); }
}

