/* Settings page: nav shortcuts + JSON backup/restore. */

.settings-note { margin: 0; padding: 10px 12px; font-size: calc(13px * var(--ui-scale)); color: var(--dimmed); background: var(--content-bg); }

/* Tabbed layout: one panel at a time instead of one long scroll. The tab strip sits inside
   the block so it shares the card edges. Panels carry no heading of their own — the tab
   label above is the heading, and repeating it inside the panel only wastes a bar. */
.settings-tabbed { padding: 0; }
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 6px;
  background: var(--content-bg-alt);
  border-bottom: 1px solid var(--border);
}
.settings-tabs button {
  padding: 10px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--dimmed);
  font: inherit;
  font-size: calc(14px * var(--ui-scale));
  font-weight: var(--fw-bold);
  cursor: pointer;
  white-space: nowrap;
}
/* Blue, not the brand orange: these are in-page tabs, and the strip has to read as part of
   the reading surface (--link), not as chrome navigation (--nav-active). */
.settings-tabs button:hover { color: var(--link); background: var(--surface-hover); }
.settings-tabs button.is-active { color: var(--link); border-bottom-color: var(--link); }
.settings-tabs button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.settings-panel { display: block; }
/* [hidden] must win over the display above, or the inactive panels stay visible. */
.settings-panel[hidden] { display: none; }
.settings-panel > .block-body--pad { padding: 12px; }
/* Panel-level count that used to ride in the removed block-header. */
.settings-count { margin: 0 0 8px; font-size: calc(13px * var(--ui-scale)); color: var(--dimmed); }

.shortcut-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row.is-dragging { opacity: .45; }
/* Drop markers: a line at the top or bottom edge of the hovered row. */
.shortcut-row.is-drop-before { box-shadow: inset 0 2px 0 var(--nav-active); }
.shortcut-row.is-drop-after { box-shadow: inset 0 -2px 0 var(--nav-active); }
.shortcut-handle { flex: 0 0 auto; color: var(--dimmed); cursor: grab; display: inline-flex; }
.shortcut-handle:active { cursor: grabbing; }
.shortcut-index { flex: 0 0 22px; text-align: right; font-size: calc(12px * var(--ui-scale)); color: var(--dimmed); font-variant-numeric: tabular-nums; }
.shortcut-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.shortcut-name { font-weight: var(--fw-bold); color: var(--link); overflow-wrap: anywhere; }
.shortcut-url { font-size: calc(12px * var(--ui-scale)); color: var(--dimmed); overflow-wrap: anywhere; }
.shortcut-row .button--small { padding: 4px; flex: 0 0 auto; }
.shortcut-row .button--small svg { display: block; }
.shortcut-empty { padding: 14px; text-align: center; color: var(--dimmed); font-size: calc(14px * var(--ui-scale)); }

.shortcut-form { border-top: 1px solid var(--border); padding-top: 14px; }
.shortcut-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Radio-card groups (Giao diện theme/font, Cuộn trang liên tục). */
.settings-subhead { margin: 16px 0 4px; font-size: calc(15px * var(--ui-scale)); font-weight: var(--fw-bold); color: var(--text); }
.settings-subhead:first-child { margin-top: 0; }
.option-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.option-card {
  display: grid;
  /* Two columns, two rows. The radio and the name share row 1 so the circle can be centred on
     the name's line box; the description spans row 2 in the text column only. Row heights are
     `auto` so both follow the current font size and --ui-scale. */
  grid-template-columns: auto 1fr;
  /* `.` keeps column 1 empty on the description row so the description stays indented under
     the name, while the radio occupies only the name row. */
  grid-template-areas: "radio name" ". desc";
  grid-template-rows: auto auto;
  gap: 0 10px;
  align-items: start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.option-card:hover { border-color: var(--link); }
.option-card.is-active { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
/* Centre the radio on the first text line: `1 / 2` keeps it in the name row only, so
   `align-self: center` centres it against that line box rather than the whole card. This
   stays correct at any --ui-scale, since the row height follows the line box. */
.option-card input { grid-area: radio; grid-row: 1 / 2; align-self: center; margin: 0; flex: 0 0 auto; }
.option-card-name { grid-area: name; font-weight: var(--fw-bold); color: var(--text); }
.option-card-desc { grid-area: desc; font-size: calc(12px * var(--ui-scale)); color: var(--dimmed); line-height: 1.5; }

/* Cỡ chữ sliders. One row per axis; the value sits in an <output> on the label line so it
   stays readable while dragging. */
.size-row { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.size-row:last-child { margin-bottom: 0; }
.size-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.size-row-head label { font-weight: var(--fw-bold); color: var(--text); }
.size-value { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); color: var(--link); }
.size-slider { display: block; width: 100%; margin: 0 0 4px; accent-color: var(--link); }
.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.settings-toggle:hover { border-color: var(--link); }
.settings-toggle-copy { display: flex; flex-direction: column; min-width: 0; }
.settings-toggle-name { font-weight: var(--fw-bold); color: var(--text); }
.settings-toggle input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--link); }
.settings-backup .code-box { min-height: 190px; font-family: Consolas, "Courier New", monospace; font-size: calc(12px * var(--ui-scale)); white-space: pre; }
.settings-backup .shortcut-form-actions { margin-top: 10px; }

.settings-reorder-controls { display: none; }
.settings-reorder-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.settings-reorder-controls button svg { display: block; width: 14px; height: 14px; }
.settings-reorder-controls button:disabled { opacity: .4; cursor: default; }

@media (max-width: 620px) {
  .settings-reorder-controls { display: flex; flex: 0 0 auto; flex-direction: column; gap: 3px; }
  .shortcut-handle { display: none; }
  .shortcut-row { gap: 6px; padding: 8px; }
  .shortcut-index { flex-basis: 16px; }
  .shortcut-row .button--small { padding: 5px; }
  .shortcut-form-actions .button { flex: 1 1 auto; justify-content: center; }
}
