/* ============================================================
   KONVERSI SATUAN — Ruang Belajar
   Prefix: .ks-
   Style reference: kalkulator (dark card, rounded, shadow)
   ============================================================ */

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

/* ---------------- INTRO ---------------- */
.ks-intro {
  text-align: center;
  max-width: 46ch;
  margin-bottom: 28px;
}

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

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

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

/* ---------------- TABS ---------------- */
.ks-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  max-width: fit-content;
  margin: 0 auto 36px;
}

.ks-tab {
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  white-space: nowrap;
}

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

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

/* ---------------- CONVERTER WRAP ---------------- */
.ks-converter-wrap {
  width: 100%;
  max-width: 500px;
}

.ks-converter {
  background: var(--ink);
  border-radius: var(--radius-lg);
  padding: 28px 24px 20px;
  box-shadow: 0 30px 60px -25px rgba(27, 31, 59, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------- INPUT GROUP ---------------- */
.ks-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ks-input-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.ks-input-row {
  display: flex;
  gap: 8px;
}

.ks-value-input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.ks-value-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.ks-value-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.ks-value-input[readonly] {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--highlight);
  cursor: default;
}

.ks-unit-select {
  width: 130px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 14px 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  transition: border-color var(--dur-fast) var(--ease);
}

.ks-unit-select:focus {
  outline: none;
  border-color: var(--accent);
}

.ks-unit-select option {
  background: var(--ink);
  color: #fff;
}

/* ---------------- SWAP BUTTON ---------------- */
.ks-swap-btn {
  align-self: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 140ms var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.ks-swap-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: #fff;
}

.ks-swap-btn:active {
  transform: scale(0.9) rotate(180deg);
}

.ks-swap-btn .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------- FORMULA ---------------- */
.ks-formula {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  margin-top: 4px;
}

.ks-formula__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.ks-formula__text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------------- REFERENCE TABLE ---------------- */
.ks-ref-wrap {
  width: 100%;
  max-width: 640px;
  margin-top: 40px;
}

.ks-ref__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-align: center;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.ks-ref__subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.ks-ref-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ks-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.ks-ref-table thead th {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.74rem;
  padding: 10px 14px;
  text-align: left;
  letter-spacing: 0.02em;
}

.ks-ref-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.ks-ref-table tbody td:first-child,
.ks-ref-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--accent-ink);
}

.ks-ref-table tbody td:last-child {
  font-weight: 700;
}

.ks-ref-table tbody tr:nth-child(even) td {
  background: rgba(27, 31, 59, 0.015);
}

.ks-ref-table tbody tr:hover td {
  background: rgba(61, 90, 254, 0.06);
}

/* ---------------- INFO CARDS ---------------- */
.ks-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 900px;
  margin-top: 40px;
}

.ks-info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  text-align: center;
  transition: box-shadow var(--dur-fast) var(--ease);
}

.ks-info-card:hover {
  box-shadow: 0 4px 16px rgba(27, 31, 59, 0.06);
}

.ks-info-card__icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 8px;
}

.ks-info-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.ks-info-card p {
  font-size: 0.84rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 600px) {
  .ks-tabs {
    gap: 3px;
    padding: 4px;
    border-radius: 16px;
  }

  .ks-tab {
    padding: 7px 11px;
    font-size: 0.76rem;
    border-radius: 14px;
  }

  .ks-converter {
    padding: 24px 18px 18px;
  }

  .ks-input-row {
    flex-direction: column;
  }

  .ks-unit-select {
    width: 100%;
  }

  .ks-value-input {
    font-size: 1.15rem;
    padding: 12px 14px;
  }

  .ks-ref-table {
    font-size: 0.74rem;
  }

  .ks-info-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .ks-info-card {
    padding: 16px 14px;
  }
}

@media (max-width: 380px) {
  .ks-info-grid {
    grid-template-columns: 1fr;
  }
}
