/* ============================================
   Decimal to Hex Converter - page styles
   Reuses design-system.css tokens throughout.
   ============================================ */

/* Segmented control row (bit width / signed / case) */
.seg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin-bottom: 1.25rem;
}

.seg-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.pill-group--seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0;
}

.pill-group--seg .pill {
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
}

.pill-group--seg.disabled .pill,
.pill[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Converter fields + sidebar */
.converter-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .converter-grid--sidebar {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .converter-grid--sidebar .base-sidebar {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .converter-grid--sidebar {
    grid-template-columns: 1fr 1fr minmax(220px, 260px);
  }
  .converter-grid--sidebar .base-sidebar {
    grid-column: auto;
  }
}

.mono,
.mono-input {
  font-family: var(--font-mono);
}

/* Copy buttons: 44px tap targets */
.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.copy-row .btn-copy {
  min-height: 44px;
  min-width: 44px;
  background: var(--color-white);
}

/* Live binary/octal sidebar */
.base-sidebar {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.base-sidebar-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.base-row {
  margin-bottom: 0.75rem;
}

.base-value-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.base-value {
  flex: 1;
  min-width: 0;
  display: block;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.625rem;
  min-height: 2.5rem;
  overflow-x: auto;
  white-space: nowrap;
}

.base-value-wrap .btn-copy {
  min-height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  background: var(--color-white);
}

.base-note {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
  line-height: 1.5;
}

/* Show-the-working panel */
.working-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.working-panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  user-select: none;
}

.working-panel summary::-webkit-details-marker {
  display: none;
}

.working-panel summary::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  transform: rotate(-45deg);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.working-panel[open] summary::before {
  transform: rotate(45deg);
}

.working-body {
  padding: 0 1rem 1rem;
}

.working-empty {
  color: var(--color-text-light);
  font-size: 0.875rem;
  margin: 0;
}

.trace-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.875rem;
}

.trace-table th,
.trace-table td {
  padding: 0.375rem 0.625rem;
  border-bottom: 1px solid var(--color-border-light);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.trace-table th {
  background: var(--color-bg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
}

.trace-table tbody tr:last-child td {
  border-bottom: none;
}

.trace-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
}

.trace-note {
  font-size: 0.875rem;
  margin: 0.625rem 0 0;
  line-height: 1.5;
}

.trace-note .mono {
  font-weight: 600;
}

/* Scrollable big reference tables (265-row cross-base, 99-row ASCII) */
.table-scroll {
  max-height: 400px;
  overflow-y: auto;
}

.table-scroll .reference-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 2;
}

.table-filter {
  max-width: 340px;
}

tr.row-hit th,
tr.row-hit td {
  background: rgba(245, 73, 0, 0.14) !important;
}

/* Colour swatch chips */
.swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  margin-right: 0.5rem;
  vertical-align: -0.125rem;
}

/* Notes column in ASCII table stays readable */
.notes-col {
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

@media (prefers-reduced-motion: reduce) {
  .working-panel summary::before {
    transition: none;
  }
  .jump-pill:hover {
    transform: none;
  }
}
