/* =========================================================
  MoleLab Interaktif - assets/css/components.css
  ---------------------------------------------------------
  Komponen UI umum:
  - mode card beranda
  - preview visual kartu mode
  - status chip, badge, icon
  - formula box
  - result card
  - calculation steps
  - input/control panel helpers
  - composition list
  - empty state
========================================================= */

/* =========================================================
  Landing Mode Cards
========================================================= */

.mode-card {
  min-height: 292px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-3xl);
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--duration-slow) var(--ease-out),
    background-color var(--duration-slow) var(--ease-out),
    border-color var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out),
    filter var(--duration-slow) var(--ease-out);
}

.mode-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -80px;
  right: -80px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.13);
  pointer-events: none;
}

.mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.12) 42%, transparent 68%);
  transform: translateX(-140%);
  pointer-events: none;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.32);
  filter: saturate(1.08);
}

.mode-card:hover::after,
.mode-card:focus-visible::after {
  animation: shimmerMove 900ms var(--ease-out);
}

.mode-card > * {
  position: relative;
  z-index: 1;
}

.mode-card-body {
  display: grid;
  gap: var(--space-2);
}

.mode-card h2 {
  color: var(--color-white);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  letter-spacing: -0.055em;
}

.mode-card p {
  color: rgba(255, 255, 255, 0.74);
  line-height: var(--leading-relaxed);
  font-size: var(--text-sm);
}

.mode-card .btn {
  min-width: 132px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.mode-preview {
  width: min(190px, 100%);
  height: 128px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.12),
    var(--shadow-sm);
}

/* =========================================================
  Home Preview Components
========================================================= */

.preview-atom,
.atom-ball {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    inset -8px -8px 12px rgba(0, 0, 0, 0.24),
    inset 7px 7px 12px rgba(255, 255, 255, 0.28),
    0 10px 24px rgba(15, 23, 42, 0.18);
  font-weight: 950;
  line-height: 1;
}

.atom-ball {
  width: 58px;
  height: 58px;
  animation: floatSoft 3.2s ease-in-out infinite;
}

.atom-h {
  background: radial-gradient(circle at 32% 28%, #bfdbfe, var(--atom-h) 48%, #1d4ed8 100%);
}

.atom-o {
  width: 76px;
  height: 76px;
  left: 92px;
  top: 7px;
  background: radial-gradient(circle at 32% 28%, #fecaca, var(--atom-o) 48%, #991b1b 100%);
  font-size: var(--text-2xl);
}

.atom-one {
  left: 28px;
  top: 28px;
}

.atom-two {
  right: 24px;
  top: 28px;
  animation-delay: 400ms;
}

.atom-bond,
.preview-bond {
  position: absolute;
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
  transform-origin: center;
}

.bond-one {
  width: 62px;
  left: 70px;
  top: 48px;
  transform: rotate(-22deg);
}

.bond-two {
  width: 62px;
  right: 64px;
  top: 48px;
  transform: rotate(22deg);
}

.preview-atom {
  width: 46px;
  height: 46px;
  font-size: var(--text-sm);
}

.atom-carbon {
  width: 58px;
  height: 58px;
  left: 66px;
  top: 35px;
  background: radial-gradient(circle at 32% 28%, #d1d5db, var(--atom-c) 54%, #020617 100%);
  font-size: var(--text-xl);
}

.atom-oxygen {
  background: radial-gradient(circle at 32% 28%, #fecaca, var(--atom-o) 50%, #991b1b 100%);
}

.oxygen-left {
  left: 22px;
  top: 41px;
}

.oxygen-right {
  right: 22px;
  top: 41px;
}

.preview-bond {
  width: 48px;
  height: 8px;
  top: 60px;
  background: var(--molecule-bond);
}

.bond-left {
  left: 56px;
}

.bond-right {
  right: 56px;
}

.mode-preview-scale {
  background: linear-gradient(135deg, #f8fafc, #e0f2fe);
}

.scale-pan {
  width: 120px;
  height: 18px;
  position: absolute;
  top: 33px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e2e8f0, #94a3b8);
  box-shadow: 0 10px 16px rgba(15, 23, 42, 0.16);
}

.scale-body {
  width: 108px;
  height: 66px;
  position: absolute;
  bottom: 18px;
  border-radius: 18px 18px 12px 12px;
  background: linear-gradient(180deg, #334155, #0f172a);
  box-shadow: var(--shadow-md);
}

.scale-display {
  position: absolute;
  bottom: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  color: #86efac;
  background: #020617;
  font-family: var(--font-mono);
  font-weight: 900;
}

.scale-result {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--success);
  font-size: var(--text-xs);
  font-weight: 950;
}

.mode-preview-particles {
  background:
    radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.18), transparent 62%),
    linear-gradient(135deg, #fefce8, #e0f2fe);
}

.avogadro-box {
  width: 96px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2xl);
  color: var(--color-white);
  background: var(--gradient-warning);
  box-shadow: var(--shadow-md);
  font-weight: 950;
}

.mode-preview-particles .particle-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
  animation: floatSoft 2.5s ease-in-out infinite;
}

.p1 { left: 26px; top: 22px; }
.p2 { right: 30px; top: 28px; animation-delay: 200ms; }
.p3 { left: 42px; bottom: 28px; animation-delay: 400ms; }
.p4 { right: 46px; bottom: 24px; animation-delay: 600ms; }
.p5 { left: 84px; top: 16px; animation-delay: 800ms; }
.p6 { right: 82px; bottom: 14px; animation-delay: 1000ms; }

.mode-preview-gas {
  background: linear-gradient(135deg, #ecfeff, #dbeafe);
}

.gas-cylinder {
  width: 74px;
  height: 102px;
  position: relative;
  overflow: hidden;
  border: 4px solid #1e40af;
  border-radius: 18px 18px 28px 28px;
  background: rgba(255, 255, 255, 0.8);
}

.gas-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.55), rgba(37, 99, 235, 0.7));
  animation: pulseSoft 2.8s ease-in-out infinite;
}

.gas-label {
  position: absolute;
  right: 14px;
  top: 16px;
  padding: 0.32rem 0.62rem;
  border-radius: var(--radius-full);
  color: var(--primary);
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  font-weight: 950;
}

.mode-preview-percent {
  background: linear-gradient(135deg, #faf5ff, #fce7f3);
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: var(--space-4);
}

.percent-ring {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background:
    conic-gradient(var(--accent-purple) 0 72%, var(--color-purple-100) 72% 100%);
  box-shadow: var(--shadow-md);
}

.percent-ring span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--color-white);
  color: var(--accent-purple);
  font-size: var(--text-2xl);
  font-weight: 950;
}

.percent-bars {
  height: 88px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-2);
}

.percent-bars .bar {
  width: 24px;
  border-radius: var(--radius-full) var(--radius-full) 0 0;
  box-shadow: var(--shadow-sm);
}

.bar-short {
  height: 36%;
  background: var(--atom-h);
}

.bar-tall {
  height: 84%;
  background: var(--atom-o);
}

.mode-preview-beaker {
  background: linear-gradient(135deg, #eff6ff, #cffafe);
}

.beaker-glass {
  width: 88px;
  height: 100px;
  position: relative;
  overflow: hidden;
  border: 4px solid rgba(15, 23, 42, 0.72);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(255, 255, 255, 0.62);
}

.beaker-glass::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: 0;
  height: 10px;
  border-radius: 50%;
  border: 4px solid rgba(15, 23, 42, 0.72);
  background: rgba(255, 255, 255, 0.85);
}

.beaker-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  background: linear-gradient(180deg, var(--solution-cyan), var(--solution-blue));
  animation: pulseSoft 3s ease-in-out infinite;
}

.bubble {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.76);
  bottom: 18px;
  z-index: 2;
  animation: floatSoft 2.2s ease-in-out infinite;
}

.b1 { left: 24px; }
.b2 { right: 20px; animation-delay: 600ms; }

.molarity-badge {
  position: absolute;
  right: 24px;
  top: 16px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md);
  font-size: var(--text-xl);
  font-weight: 950;
}

.mode-preview-game {
  background: linear-gradient(135deg, #f5d0fe, #ddd6fe);
}

.game-question-mark {
  font-size: 5rem;
  font-weight: 950;
  line-height: 1;
}

.star-row {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-1);
  color: var(--warning);
  font-size: var(--text-2xl);
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
}

/* =========================================================
  Cards, Icons, Chips
========================================================= */

.info-card {
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.info-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-white);
  font-size: var(--text-lg);
  font-weight: 950;
  line-height: 1;
}

.icon-sigma,
.icon-divide,
.icon-dot {
  background: var(--gradient-primary);
}

.icon-divide {
  background: var(--gradient-success);
}

.icon-dot {
  background: var(--gradient-warning);
}

.mode-label-card {
  display: grid;
  gap: 0;
  min-width: 142px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-md);
}

.mode-label-card span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-label-card strong {
  color: var(--text-main);
  font-size: var(--text-lg);
  letter-spacing: -0.03em;
}

.badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  font-weight: 900;
  white-space: nowrap;
}

.badge {
  min-height: 28px;
  padding: 0.25rem 0.65rem;
  color: var(--color-white);
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
}

.badge-neutral { background: var(--color-slate-500); }
.badge-primary { background: var(--primary); }
.badge-success { background: var(--success); }
.badge-warning { background: var(--accent-orange); }
.badge-danger { background: var(--danger); }
.badge-purple { background: var(--accent-purple); }

.status-chip {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-base);
}

.status-neutral { color: var(--color-slate-600); }
.status-positive { color: var(--accent-orange); }
.status-negative { color: var(--primary); }
.status-wait { color: var(--text-muted); }
.status-success { color: var(--success); }
.status-danger { color: var(--danger); }

/* =========================================================
  Formula, Result, Calculation Steps
========================================================= */

.formula-box {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 12% 12%, rgba(96, 165, 250, 0.14), transparent 34%),
    rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
}

.formula-box strong {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
}

.formula-box p {
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.result-card {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(circle at 50% 0%, rgba(250, 204, 21, 0.16), transparent 46%),
    rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.result-card span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card strong {
  color: var(--primary);
  font-size: var(--text-4xl);
  line-height: 1;
  letter-spacing: -0.06em;
}

.result-card p {
  color: var(--text-muted);
  font-weight: 750;
}

.large-result strong {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
}

.calculation-steps {
  display: grid;
  gap: var(--space-3);
}

.calc-step,
.calculation-step {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  animation: popIn var(--duration-slow) var(--ease-out);
}

.calc-step-title,
.calculation-step-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-main);
  font-weight: 900;
}

.calc-step-title::before,
.calculation-step-title::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

.calc-step-expression,
.calculation-step-expression {
  color: var(--color-slate-700);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: var(--leading-relaxed);
}

.calc-step-result,
.calculation-step-result {
  color: var(--success);
  font-weight: 950;
}

/* =========================================================
  Element / Composition Lists
========================================================= */

.element-ar-list,
.composition-list {
  display: grid;
  gap: var(--space-2);
}

.element-ar-item,
.composition-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 46px;
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
}

.element-symbol-chip {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-white);
  background: var(--gradient-primary);
  font-weight: 950;
  box-shadow: var(--shadow-sm);
}

.element-ar-item strong,
.composition-item strong {
  color: var(--text-main);
  font-weight: 900;
}

.element-ar-item span,
.composition-item span {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 750;
}

.composition-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.08);
}

.composition-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gradient-primary);
  transition: width var(--duration-extra-slow) var(--ease-out);
}

/* =========================================================
  Feedback, Notes, Warnings
========================================================= */

.feedback-box,
.concept-warning-card p {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.76);
  font-weight: 800;
  line-height: var(--leading-normal);
}

.feedback-box.is-success {
  color: var(--color-green-700);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.22);
}

.feedback-box.is-error {
  color: var(--color-red-700);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.22);
}

.feedback-box.is-warning,
.concept-warning-card p {
  color: var(--color-orange-700);
  background: var(--color-orange-100);
  border-color: rgba(234, 88, 12, 0.22);
}

/* =========================================================
  Utility UI States
========================================================= */

.is-highlighted {
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.16), var(--shadow-md) !important;
}

.is-correct {
  color: var(--color-green-700) !important;
  background: var(--success-soft) !important;
  border-color: rgba(22, 163, 74, 0.26) !important;
}

.is-wrong,
.is-error {
  color: var(--color-red-700) !important;
  background: var(--danger-soft) !important;
  border-color: rgba(220, 38, 38, 0.26) !important;
}

.loading-shimmer {
  position: relative;
  overflow: hidden;
}

.loading-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.45) 42%, transparent 68%);
  transform: translateX(-120%);
  animation: shimmerMove 1.4s linear infinite;
}

/* =========================================================
  Responsive Lock-Friendly Tweaks
========================================================= */

@media (max-width: 900px) {
  .mode-card {
    min-height: 292px;
  }

  .mode-preview {
    width: min(190px, 100%);
  }

  .action-row {
    flex-direction: row;
  }
}

@media (max-width: 520px) {
  .mode-card h2 {
    font-size: var(--text-3xl);
  }

  .chip-button,
  .mini-tab {
    font-size: var(--text-sm);
  }
}
