/* ============================================================
   BANGUN DATAR & RUANG — Ruang Belajar
   Prefix: .bg-
   ============================================================ */

.bg-page {
  padding: 56px 0 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bg-intro {
  text-align: center;
  max-width: 48ch;
  margin-bottom: 24px;
}

.bg-intro .hero__eyebrow {
  margin-bottom: 18px;
}

.bg-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.bg-intro p {
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.6;
}

/* ---------------- TYPE TABS ---------------- */
.bg-type-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  max-width: fit-content;
  margin: 0 auto 24px;
}

.bg-type-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.bg-type-tab:hover {
  color: var(--ink);
}

.bg-type-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.bg-type-tab__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---------------- SHAPE SELECTOR ---------------- */
.bg-shape-selector {
  width: 100%;
  max-width: 680px;
  margin-bottom: 28px;
}

.bg-shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.bg-shape-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 140ms var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bg-shape-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(27, 31, 59, 0.08);
}

.bg-shape-card:active {
  transform: scale(0.95);
}

.bg-shape-card.is-active {
  border-color: var(--accent);
  background: rgba(61, 90, 254, 0.04);
  box-shadow: 0 0 0 3px rgba(61, 90, 254, 0.15);
}

.bg-shape-card__icon {
  width: 32px;
  height: 32px;
  stroke: var(--ink);
  transition: stroke var(--dur-fast) var(--ease);
}

.bg-shape-card.is-active .bg-shape-card__icon {
  stroke: var(--accent);
}

.bg-shape-card__name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

/* ---------------- CONTENT LAYOUT ---------------- */
.bg-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1000px;
  align-items: start;
}

/* ---------------- VISUAL PANEL ---------------- */
.bg-visual {
  background: var(--ink);
  border-radius: var(--radius-lg);
  min-height: 400px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 30px 60px -25px rgba(27, 31, 59, 0.45);
}

.bg-visual__placeholder {
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bg-visual__placeholder-icon {
  width: 64px;
  height: 64px;
  stroke: rgba(255, 255, 255, 0.3);
}

.bg-visual__placeholder p {
  margin: 0;
  font-size: 0.88rem;
}

#bg-canvas-2d {
  width: 100%;
  height: 100%;
}

#bg-container-3d {
  width: 100%;
  height: 100%;
}

.bg-visual__hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  padding: 5px 14px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bg-visual__hint .icon {
  width: 14px;
  height: 14px;
  stroke: rgba(255, 255, 255, 0.35);
}

/* ---------------- CALCULATOR PANEL ---------------- */
.bg-calculator {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 400px;
}

.bg-calc__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 340px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  gap: 10px;
}

.bg-calc__placeholder-icon {
  width: 48px;
  height: 48px;
  stroke: var(--ink-soft);
  opacity: 0.4;
}

.bg-calc__placeholder p {
  margin: 0;
}

.bg-calc__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.bg-calc__inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.bg-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bg-input-group label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.bg-input-group input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease);
}

.bg-input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 90, 254, 0.1);
}

.bg-calc__results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.bg-result-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.bg-result-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 2px;
  display: block;
}

.bg-result-card__value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.bg-result-card--full {
  grid-column: 1 / -1;
}

.bg-calc__formula {
  background: rgba(61, 90, 254, 0.04);
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
}

.bg-calc__formula span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 3px;
}

.bg-calc__formula code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: transparent;
  display: block;
  margin-top: 4px;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 800px) {
  .bg-content {
    grid-template-columns: 1fr;
  }

  .bg-visual {
    min-height: 300px;
  }

  .bg-shape-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  .bg-shape-card {
    padding: 10px 6px;
  }

  .bg-shape-card__icon {
    width: 26px;
    height: 26px;
  }

  .bg-shape-card__name {
    font-size: 0.7rem;
  }

  .bg-type-tab {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}
