/*--------------------------------------------------------------
# Unit Converter page
# Builds on the shared primitives in style.css:
#   .calc-card / .icon-tab-grid / .icon-tab / .option-rows /
#   .option-row / .option-row-label / .result-unit-toggle /
#   .unit-tab / .preset-load-btn
# This file styles the converter's specific layout: the
# from/to row with the swap pivot, the headline readout, and
# the "all conversions" list at the bottom.
--------------------------------------------------------------*/
.converter-section { padding: 60px 0; }

/* The card grows wider than 900 px on large screens because the
   from/to fields + swap pivot need horizontal room to breathe. */
.conv-card {
  max-width: 1100px;
  padding: 30px 30px 36px;
}

/* ── Category picker ────────────────────────────────────────────────────── */
/* 15 categories laid out as a 5-up grid on desktop, scaling down on mobile.
   Inherits hover/active styling from the shared .icon-tab. */
.conv-cat-grid {
  margin: 4px 0 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid #eef0f2;
  /* Override the shared 5-column default so 15 categories sit cleanly in
     a 5×3 grid on desktop. */
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* ── Conversion form ────────────────────────────────────────────────────── */
.conv-form { margin: 0; }

/* Two-column from/to grid with a small swap pivot in the middle. The
   middle column collapses to its content's width via `auto`. */
.conv-field-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: end;
  margin-bottom: 24px;
}
.conv-side { min-width: 0; }
.conv-side-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

/* Each side is an [input | select] row that fills its column. */
.conv-input-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
}
.conv-input-row input,
.conv-input-row select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: "Open Sans", sans-serif;
  color: #45505b;
  background: #fff;
  border: 1.5px solid #d0dae8;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.conv-input-row input:focus,
.conv-input-row select:focus {
  outline: none;
  border-color: #0563bb;
  box-shadow: 0 0 0 3px rgba(5, 99, 187, 0.18);
}
.conv-input-row input {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.conv-input-row select { cursor: pointer; }

/* Circular swap pivot. Sits centred between the two sides, vertically
   aligned to the input row (not the label) thanks to `align-items: end`. */
.conv-swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f8fafd;
  border: 1.5px solid #d0dae8;
  color: #0563bb;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  margin-bottom: 0;
  flex-shrink: 0;
}
.conv-swap-btn:hover {
  background: #e8f0fb;
  border-color: #0563bb;
  transform: rotate(180deg);
}
.conv-swap-btn:focus-visible {
  outline: none;
  border-color: #0563bb;
  box-shadow: 0 0 0 3px rgba(5, 99, 187, 0.18);
}

/* ── Headline readout ──────────────────────────────────────────────────── */
.conv-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: #f1f7ff;
  border: 1px solid #c4d6ed;
  border-radius: 10px;
  margin-bottom: 22px;
  font-family: "Poppins", sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #0c2c5c;
  font-variant-numeric: tabular-nums;
}
.conv-readout #conv-readout-text {
  word-break: break-word;
  min-width: 0;
}
.conv-readout #conv-copy-btn { margin: 0; flex-shrink: 0; }
.conv-readout .is-copied {
  background: #28a745 !important;
  border-color: #28a745 !important;
  color: #fff !important;
}

/* Tighter version of .option-rows — the Precision picker is the only row
   so it doesn't need a hairline divider above the next section. */
.conv-options { margin-bottom: 26px; padding-bottom: 0; border-bottom: none; }

/* ── All-conversions panel ─────────────────────────────────────────────── */
.conv-all-panel {
  border-top: 1px solid #eef0f2;
  padding-top: 22px;
}
.conv-all-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.conv-all-header h4 {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #45505b;
}
.conv-all-sub {
  font-size: 13px;
  color: #6c757d;
  font-variant-numeric: tabular-nums;
}

/* Two-column dense list of every unit in the active category, with the
   currently-selected source unit highlighted. */
.conv-all-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px 18px;
}
.conv-all-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f8fafd;
  font-size: 13.5px;
  color: #45505b;
}
.conv-all-item .conv-all-unit {
  color: #6c757d;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-all-item .conv-all-value {
  font-weight: 600;
  color: #0563bb;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.conv-all-item.is-current {
  background: #e8f0fb;
  border-color: #c4d6ed;
}
.conv-all-item.is-current .conv-all-unit { color: #0c2c5c; font-weight: 600; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .conv-cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .converter-section { padding: 36px 0; }
  .conv-card { padding: 20px 18px 26px; }

  /* Category grid: 3-up on tablet/phone — already handled by the shared
     .icon-tab-grid mobile rule, but we re-state it here so this page's
     row-count stays predictable even if the shared rule changes. */
  .conv-cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* Stack the from/to fields vertically with the swap pivot between them.
     The pivot rotates 90 degrees so it points down→up like an arrow. */
  .conv-field-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .conv-swap-btn {
    justify-self: center;
    margin: 4px 0;
    transform: rotate(90deg);
  }
  .conv-swap-btn:hover { transform: rotate(270deg); }

  .conv-input-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .conv-readout {
    font-size: 15px;
    padding: 12px 14px;
  }
  .conv-all-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .conv-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
