/* Unit conversions page */

.units-main {
  padding: 1.5rem 1.75rem 2.5rem;
}

.units-page-title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.units-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.units-tab {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.units-tab:hover {
  border-color: rgba(123, 134, 232, 0.45);
  color: var(--blue);
}

.units-tab.is-active {
  border-color: var(--purple);
  background: var(--result-bg);
  color: var(--purple);
}

.units-panel {
  padding: 1.5rem;
  background: var(--result-bg);
  border: 1px solid rgba(59, 113, 219, 0.12);
  border-radius: 14px;
}

[data-theme="dark"] .units-panel {
  border-color: rgba(107, 159, 255, 0.15);
}

.units-converter {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem 1.25rem;
  align-items: end;
}

.units-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.units-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.units-input,
.units-select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.units-input:focus,
.units-select:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.units-input {
  font-variant-numeric: tabular-nums;
}

.units-swap-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 0.15rem;
}

.units-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.units-swap:hover {
  border-color: var(--purple);
  background: rgba(123, 134, 232, 0.08);
  transform: rotate(180deg);
}

.units-swap:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.units-result-box {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
}

.units-result-label {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.units-result-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
  word-break: break-all;
}

.units-formula {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .units-main {
    padding: 1.25rem;
  }

  .units-converter {
    grid-template-columns: 1fr;
  }

  .units-swap-wrap {
    padding: 0;
  }

  .units-swap {
    transform: rotate(90deg);
  }

  .units-swap:hover {
    transform: rotate(270deg);
  }
}
