/* /public/css/settings-page.css
   Shared chrome for the Settings hub (settings-preview.html) and every
   /settings/*.html sub-page. Pairs with app-theme.css for the body bg
   + tokens. Class names match what the existing sub-pages already use
   (.card, .row, .label, .switch, .btn, etc.) so the JS in each page
   keeps working unchanged -- this file just redefines the visual.

   Architecture rule: this file does NOT carry page-specific styling
   (chat color picker, data quota bars, etc.). Those live inline in the
   sub-page that needs them. This file owns the COMMON shell only. */

* , *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
/* overscroll-behavior:none stops Android Chrome's rubber-band, which on the
   settings tree showed up as ~1 toolbar of extra scroll travel at both ends. */
html { overscroll-behavior: none; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  overscroll-behavior: none;
}

/* TOP BAR ----------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  padding-top: calc(14px + var(--safe-top));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 10;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.back-btn::before { content: "←"; font-size: 1.1em; }
.back-btn:hover { background: rgba(255,255,255,.12); border-color: var(--border-strong); }
.back-btn:active { transform: scale(.97); }
.page-title {
  font-size: 14px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* MAIN CONTAINER ---------------------------------------------------- */
main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 18px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 16px;
}

/* SETTINGS HUB LIST (settings-preview.html) ------------------------- */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.settings-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.settings-item:hover { background: rgba(255,255,255,.06); border-color: var(--border-strong); }
.settings-item:active { transform: scale(.99); }
.settings-item-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}
.settings-item-text { flex: 1; min-width: 0; }
.settings-item-title { font-size: 15px; font-weight: 600; color: var(--text); }
.settings-item-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.settings-item-arrow { color: var(--text-dim); font-size: 18px; flex-shrink: 0; }

/* CARD (sub-page section) ------------------------------------------ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.card-header {
  font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ROW --------------------------------------------------------------- */
.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
}
.row + .row { border-top: 1px solid var(--border); }
.label { font-size: 14px; color: var(--text); flex: 1; min-width: 0; }
.hint  { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }
.stacked { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.inline-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* SWITCH ------------------------------------------------------------ */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.slider::before {
  content: ""; position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); background: #0a0a0a; }

/* INPUT / SELECT ---------------------------------------------------- */
select, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=url], textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit; font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,.08);
}
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='rgba(232,228,220,.6)' d='M6 9L1 4h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
textarea { min-height: 80px; resize: vertical; }

/* BUTTON ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, border-color .15s, filter .15s, transform .08s;
}
.btn:hover { background: rgba(255,255,255,.10); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); color: #0a0a0a; border-color: transparent;
  font-weight: 700;
}
.btn.primary:hover { filter: brightness(.92); }
.btn.danger {
  background: rgba(255,77,106,.12); color: var(--danger);
  border-color: rgba(255,77,106,.4);
}
.btn.danger:hover { background: rgba(255,77,106,.18); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.ghost { background: transparent; }

/* NOTICES ----------------------------------------------------------- */
.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.5;
  border: 1px solid var(--border);
}
.notice.info    { background: rgba(94,148,255,.08); border-color: rgba(94,148,255,.3); color: #a8c4ff; }
.notice.warn    { background: rgba(255,170,42,.08); border-color: rgba(255,170,42,.3); color: #ffd28a; }
.notice.danger  { background: rgba(255,77,106,.08); border-color: rgba(255,77,106,.3); color: #ffb3bf; }
.notice.success { background: rgba(106,207,115,.08); border-color: rgba(106,207,115,.3); color: #a4e3aa; }

/* CODE BOX (small inline code/URL display) ------------------------- */
.code-box {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(0,0,0,.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  word-break: break-all;
}

/* RESPONSIVE -------------------------------------------------------- */
@media (max-width: 480px) {
  main { padding: 16px 14px calc(16px + var(--safe-bottom)); }
  .card { padding: 14px 16px; }
  .topbar { padding: 12px 14px; padding-top: calc(12px + var(--safe-top)); }
  .page-title { font-size: 13px; letter-spacing: .12em; }
}
