/* =========================================================
  MoleLab Interaktif - assets/css/concentration.css
  ---------------------------------------------------------
  Visual khusus mode Konsentrasi:
  - beaker / gelas larutan
  - cairan dan level volume
  - partikel zat terlarut
  - animasi pengadukan / pencampuran
  - molaritas, molalitas, fraksi mol
  - panel tab konsentrasi
  - visual pelarut dan campuran
========================================================= */

/* =========================================================
  Concentration Mode Shell
========================================================= */

.concentration-lab-panel {
  isolation: isolate;
}

.concentration-lab-panel::before,
.concentration-lab-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: var(--radius-full);
  z-index: 0;
}

.concentration-lab-panel::before {
  width: 460px;
  height: 460px;
  left: -150px;
  top: -120px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 70%);
}

.concentration-lab-panel::after {
  width: 380px;
  height: 380px;
  right: -130px;
  bottom: -150px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent 70%);
}

.beaker-stage {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.76), transparent 54%),
    linear-gradient(180deg, rgba(236, 254, 255, 0.58), rgba(239, 246, 255, 0.66));
}

.beaker-stage::after {
  content: "Larutan";
  position: absolute;
  left: var(--space-6);
  bottom: var(--space-6);
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-xs);
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* =========================================================
  Concentration Tabs
========================================================= */

.concentration-tabs .mini-tab {
  min-width: 112px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.72);
}

.concentration-tabs .mini-tab.is-active {
  color: var(--color-white);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md), var(--shadow-glow-blue);
}

.concentration-tabs .mini-tab[data-concentration-tab="molality"].is-active {
  background: var(--gradient-success);
}

.concentration-tabs .mini-tab[data-concentration-tab="mole-fraction"].is-active {
  background: var(--gradient-purple);
}

/* =========================================================
  Beaker Large Visual
========================================================= */

.beaker-large {
  width: 330px;
  height: 430px;
  position: relative;
  display: block;
  overflow: hidden;
  border: 7px solid rgba(15, 23, 42, 0.74);
  border-top: 0;
  border-radius: 0 0 58px 58px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.16) 36%, rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.34);
  box-shadow:
    inset 0 0 42px rgba(255, 255, 255, 0.46),
    var(--shadow-xl),
    var(--shadow-glow-blue);
  transform: translateY(10px);
}

.beaker-large::before {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  top: -18px;
  height: 52px;
  border-radius: 50%;
  border: 7px solid rgba(15, 23, 42, 0.74);
  background: rgba(255, 255, 255, 0.88);
  z-index: 8;
}

.beaker-large::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 22px;
  height: 76%;
  border-radius: 0 0 40px 40px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 28%, rgba(255, 255, 255, 0.22));
  pointer-events: none;
  z-index: 7;
}

.beaker-liquid-large {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54%;
  background:
    radial-gradient(circle at 28% 10%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(180deg, var(--solution-cyan), var(--solution-blue));
  transition:
    height var(--duration-extra-slow) var(--ease-out),
    background-color var(--duration-extra-slow) var(--ease-out),
    filter var(--duration-extra-slow) var(--ease-out);
  animation: solutionWave 3.4s ease-in-out infinite;
  z-index: 1;
}

.beaker-liquid-large::before {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: -24px;
  height: 48px;
  border-radius: 50%;
  background: rgba(147, 197, 253, 0.68);
  animation: liquidSurface 3.4s ease-in-out infinite;
}

.beaker-liquid-large::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 22%, rgba(255, 255, 255, 0.22), transparent 18%),
    radial-gradient(circle at 78% 44%, rgba(255, 255, 255, 0.16), transparent 22%);
  mix-blend-mode: screen;
}

.beaker-large.is-molarity .beaker-liquid-large {
  background:
    radial-gradient(circle at 28% 10%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(180deg, rgba(34, 211, 238, 0.58), rgba(37, 99, 235, 0.72));
}

.beaker-large.is-molality .beaker-liquid-large {
  background:
    radial-gradient(circle at 28% 10%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(180deg, rgba(134, 239, 172, 0.62), rgba(22, 163, 74, 0.68));
}

.beaker-large.is-mole-fraction .beaker-liquid-large {
  background:
    radial-gradient(circle at 28% 10%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(180deg, rgba(216, 180, 254, 0.64), rgba(147, 51, 234, 0.62));
}

.beaker-markings {
  position: absolute;
  right: 18px;
  top: 62px;
  bottom: 62px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: rgba(15, 23, 42, 0.72);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 950;
}

.beaker-markings span {
  position: relative;
  padding-right: 34px;
}

.beaker-markings span::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 28px;
  height: 2px;
  background: rgba(15, 23, 42, 0.52);
  transform: translateY(-50%);
}

@keyframes solutionWave {
  0%, 100% {
    filter: saturate(1) brightness(1);
  }
  50% {
    filter: saturate(1.12) brightness(1.04);
  }
}

@keyframes liquidSurface {
  0%, 100% {
    transform: translateY(0) scaleX(1);
  }
  50% {
    transform: translateY(-2px) scaleX(1.04);
  }
}

/* =========================================================
  Solute Particles
========================================================= */

.solute-particles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.solute-dot,
.solvent-dot,
.mixture-dot {
  position: absolute;
  border-radius: var(--radius-full);
  box-shadow:
    inset -4px -4px 8px rgba(0, 0, 0, 0.2),
    inset 3px 3px 7px rgba(255, 255, 255, 0.54),
    0 0 14px rgba(37, 99, 235, 0.25);
  animation: soluteFloat 4.2s ease-in-out infinite;
}

.solute-dot {
  width: 17px;
  height: 17px;
  background: var(--primary);
}

.solvent-dot {
  width: 13px;
  height: 13px;
  background: var(--accent-cyan);
  opacity: 0.76;
}

.mixture-dot {
  width: 18px;
  height: 18px;
  background: var(--accent-purple);
}

.solute-dot.is-na {
  background: var(--atom-na);
}

.solute-dot.is-cl {
  background: var(--atom-cl);
}

.solute-dot.is-sugar {
  background: var(--accent-purple);
}

.solute-dot.is-acid {
  background: var(--danger);
}

@keyframes soluteFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.86;
  }
  33% {
    transform: translate(10px, -16px) scale(1.08);
    opacity: 1;
  }
  66% {
    transform: translate(-8px, 10px) scale(0.96);
    opacity: 0.78;
  }
}

/* =========================================================
  Pouring / Mixing Animations
========================================================= */

.pour-stream {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 22px;
  height: 160px;
  z-index: 12;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.08), rgba(37, 99, 235, 0.62));
  transform: translateX(-50%) rotate(8deg);
  transform-origin: top center;
  animation: pourStream 900ms var(--ease-in-out) both;
}

.solute-fall-dot {
  position: absolute;
  top: 0;
  z-index: 13;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--warning);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.5);
  animation: soluteFall 980ms var(--ease-in-out) both;
}

.stirrer {
  position: absolute;
  left: 50%;
  top: 80px;
  z-index: 11;
  width: 12px;
  height: 270px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, #e2e8f0, #64748b);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%) rotate(-18deg);
  animation: stirMotion 1.4s ease-in-out infinite;
}

.stirrer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 84px;
  height: 14px;
  border-radius: var(--radius-full);
  background: #64748b;
  transform: translateX(-50%) rotate(8deg);
}

.mixing-ripple {
  position: absolute;
  left: 50%;
  bottom: 132px;
  z-index: 5;
  width: 90px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: mixingRipple 1.4s ease-out infinite;
}

@keyframes pourStream {
  0% {
    opacity: 0;
    transform: translateX(-50%) rotate(8deg) scaleY(0);
  }
  20%, 80% {
    opacity: 1;
    transform: translateX(-50%) rotate(8deg) scaleY(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) rotate(8deg) scaleY(0.2);
  }
}

@keyframes soluteFall {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(260px) scale(1.08);
  }
}

@keyframes stirMotion {
  0%, 100% {
    transform: translateX(-50%) rotate(-18deg);
  }
  50% {
    transform: translateX(-50%) rotate(18deg);
  }
}

@keyframes mixingRipple {
  0% {
    opacity: 0.8;
    transform: translateX(-50%) scale(0.65);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(2.6);
  }
}

/* =========================================================
  Concentration Meter
========================================================= */

.concentration-meter {
  border: 1px solid rgba(255, 255, 255, 0.74);
  background:
    radial-gradient(circle at 20% 0%, rgba(96, 165, 250, 0.16), transparent 34%),
    rgba(255, 255, 255, 0.92);
}

.concentration-meter strong {
  color: var(--primary);
  transition: color var(--duration-normal) var(--ease-out);
}

.concentration-meter.is-molarity strong {
  color: var(--primary);
}

.concentration-meter.is-molality strong {
  color: var(--success);
}

.concentration-meter.is-mole-fraction strong {
  color: var(--accent-purple);
}

.concentration-meter::after {
  content: "";
  width: 100%;
  height: 8px;
  display: block;
  margin-top: var(--space-2);
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.26);
}

.concentration-meter.is-molality::after {
  background: linear-gradient(90deg, var(--success), var(--color-green-300));
}

.concentration-meter.is-mole-fraction::after {
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
}

/* =========================================================
  Molarity Visual Helpers
========================================================= */

.molarity-volume-card,
.molality-solvent-card,
.fraction-total-card {
  position: absolute;
  left: var(--space-8);
  top: var(--space-8);
  z-index: 10;
  width: 220px;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-md);
}

.molarity-volume-card span,
.molality-solvent-card span,
.fraction-total-card span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.molarity-volume-card strong,
.molality-solvent-card strong,
.fraction-total-card strong {
  color: var(--primary);
  font-size: var(--text-2xl);
  line-height: 1;
}

.molality-solvent-card strong {
  color: var(--success);
}

.fraction-total-card strong {
  color: var(--accent-purple);
}

/* =========================================================
  Molality Visual: Solvent Mass Scale
========================================================= */

.solvent-scale-mini {
  position: absolute;
  left: var(--space-8);
  bottom: var(--space-8);
  z-index: 10;
  width: 230px;
  height: 126px;
  display: grid;
  place-items: center;
}

.solvent-scale-mini::before {
  content: "";
  position: absolute;
  top: 18px;
  width: 142px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8fafc, #94a3b8);
  box-shadow: var(--shadow-sm);
}

.solvent-scale-mini::after {
  content: "kg pelarut";
  position: absolute;
  bottom: 10px;
  min-width: 142px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-lg);
  color: #86efac;
  background: var(--color-slate-950);
  box-shadow: var(--shadow-md);
  font-family: var(--font-mono);
  font-weight: 950;
  text-align: center;
}

.solvent-drop {
  position: absolute;
  top: -4px;
  width: 36px;
  height: 46px;
  border-radius: 50% 50% 54% 46% / 42% 42% 58% 58%;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.8), rgba(37, 99, 235, 0.68));
  box-shadow: var(--shadow-sm);
  transform: rotate(45deg);
  animation: solventDropPulse 2.4s ease-in-out infinite;
}

@keyframes solventDropPulse {
  0%, 100% {
    transform: rotate(45deg) translateY(0) scale(1);
  }
  50% {
    transform: rotate(45deg) translateY(-8px) scale(1.06);
  }
}

/* =========================================================
  Mole Fraction Visual
========================================================= */

.fraction-mixture-panel {
  position: absolute;
  left: var(--space-8);
  top: var(--space-8);
  z-index: 10;
  width: 260px;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-md);
}

.fraction-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
}

.fraction-dot {
  width: 28px;
  height: 28px;
  display: inline-block;
  border-radius: var(--radius-full);
  box-shadow:
    inset -4px -4px 7px rgba(0, 0, 0, 0.22),
    inset 3px 3px 7px rgba(255, 255, 255, 0.5);
}

.fraction-dot.solute {
  background: var(--accent-purple);
}

.fraction-dot.solvent {
  background: var(--accent-cyan);
}

.fraction-label {
  color: var(--text-main);
  font-weight: 900;
}

.fraction-value {
  color: var(--accent-purple);
  font-family: var(--font-mono);
  font-weight: 950;
}

.fraction-bar-track {
  grid-column: 2 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.08);
}

.fraction-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gradient-purple);
  transition: width 720ms var(--ease-out);
}

.fraction-row.solvent-row .fraction-value {
  color: var(--accent-cyan);
}

.fraction-row.solvent-row .fraction-bar-fill {
  background: linear-gradient(90deg, var(--accent-cyan), var(--primary));
}

/* =========================================================
  Concentration Formula Box States
========================================================= */

#concentrationFormulaBox {
  transition:
    background-color var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out);
}

#concentrationFormulaBox[data-concentration="molarity"] strong {
  color: var(--primary);
}

#concentrationFormulaBox[data-concentration="molality"] strong {
  color: var(--success);
}

#concentrationFormulaBox[data-concentration="mole-fraction"] strong {
  color: var(--accent-purple);
}

/* =========================================================
  Concentration Control Visibility
========================================================= */

.concentration-field {
  display: none;
}

.concentration-controls[data-active-tab="molarity"] .concentration-field-molarity,
.concentration-controls[data-active-tab="molality"] .concentration-field-molality,
.concentration-controls[data-active-tab="mole-fraction"] .concentration-field-fraction {
  display: grid;
}

.concentration-controls[data-active-tab="molarity"] {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.concentration-controls[data-active-tab="molality"] {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.concentration-controls[data-active-tab="mole-fraction"] {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

/* =========================================================
  Concept Note States
========================================================= */

.concept-warning-card p[data-concentration="molarity"] {
  color: var(--color-blue-700);
  background: var(--color-blue-50);
  border-color: rgba(37, 99, 235, 0.22);
}

.concept-warning-card p[data-concentration="molality"] {
  color: var(--color-green-700);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.22);
}

.concept-warning-card p[data-concentration="mole-fraction"] {
  color: var(--color-purple-700);
  background: var(--color-purple-100);
  border-color: rgba(147, 51, 234, 0.22);
}

/* =========================================================
  Responsive Lock Friendly
========================================================= */

@media (max-width: 900px) {
  .beaker-large {
    width: 330px;
    height: 430px;
  }

  .concentration-tabs {
    left: 50%;
    transform: translateX(-50%);
  }

  .concentration-controls[data-active-tab="molarity"],
  .concentration-controls[data-active-tab="molality"],
  .concentration-controls[data-active-tab="mole-fraction"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  }
}

@media (max-width: 520px) {
  .beaker-large {
    width: 330px;
    height: 430px;
  }

  .concentration-tabs .mini-tab {
    min-width: 112px;
  }

  .molarity-volume-card,
  .molality-solvent-card,
  .fraction-total-card,
  .fraction-mixture-panel {
    width: 220px;
  }
}
