/* ==========================================================================
   css/components/settings-modal.css
   Split from app.html (build 2026.10.08.9-beta), original lines 3322-3576.
   Rules are in their ORIGINAL order; load order is defined in index.html.
   ========================================================================== */
/* Settings modal */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.settings-overlay.open { display: flex; animation: overlay-in 0.15s ease; }
.settings-overlay.open .settings-modal,
.settings-overlay.open .settings-modal-full { animation: modal-pop 0.22s var(--ease-out, ease); }
.settings-modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 460px;
  max-width: 90vw;
  overflow: hidden;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.settings-header h2 { font-family: var(--font-display,'Space Grotesk',sans-serif); font-size: 18px; font-weight: 700; }
.settings-close {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 18px;
}
.settings-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.settings-value { font-size: 13px; color: var(--text-muted); }
.settings-btn-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn-danger {
  background: var(--red); color: #fff; border: none;
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { opacity: 0.85; }
/* Settings modal */
/* Bigger. 1080x820 was set when the content column was narrower; on a normal desktop it leaves
   the settings floating as a small card in the middle of a large window while its own rows are
   cramped. The viewport caps still do the work on a small screen or a split window. */
.settings-modal-full {
  display: flex; flex-direction: row;
  width: min(1340px, 94vw);
  height: min(900px, 92vh);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
/* 220 was tight enough that "Desktop & Updates" and "Transaction History" ran to the edge. */
.settings-sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--bg-modal-side);
  padding: 20px 8px 20px 16px;
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
}
.settings-nav-section {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 14px 10px 5px; pointer-events: none; user-select: none;
}
.settings-nav-section:first-child { padding-top: 4px; }
.settings-nav-item {
  padding: 8px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-secondary); }
.settings-nav-item.active { background: var(--bg-active); color: var(--text-primary); font-weight: 600; }
.settings-nav-item.danger { color: var(--red, #ef4444); }
.settings-nav-item.danger:hover { background: rgba(239,68,68,0.1); }
.settings-nav-sep { height: 1px; background: var(--border); margin: 6px 0; }
/* Static sub-section: a parent label with children shown as a small tree (no dropdown) */
.settings-nav-plabel { padding: 7px 10px 3px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.settings-nav-tree { position: relative; }
.settings-nav-tree .settings-nav-child { position: relative; margin-left: 15px; padding-left: 16px; font-size: 13px; }
.settings-nav-tree .settings-nav-child::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--border-strong, #3a3d4d); }
.settings-nav-tree .settings-nav-child::after { content: ''; position: absolute; left: 0; top: 50%; width: 10px; height: 2px; background: var(--border-strong, #3a3d4d); }
.settings-nav-tree .settings-nav-child:last-child::before { bottom: auto; height: 50%; border-bottom-left-radius: 7px;
  width: 10px; background: none; border-left: 2px solid var(--border-strong, #3a3d4d); border-bottom: 2px solid var(--border-strong, #3a3d4d); }
.settings-nav-tree .settings-nav-child:last-child::after { display: none; }
/* Activity / Billing settings panels */
.act-toggle { display: flex; align-items: flex-start; gap: 12px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px; margin-bottom: 12px; cursor: pointer; }
.act-toggle input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--accent); }
.act-toggle b { font-size: 13.5px; color: var(--text-primary); font-weight: 600; }
.act-sub { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.rg-input { flex: 1; background: var(--bg-void); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; color: var(--text-primary); font-size: 13px; outline: none; }
.rg-input:focus { border-color: var(--accent); }
.rg-label { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; }
.rg-hotkey { display: inline-block; background: var(--bg-void); border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 14px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: border-color .12s, color .12s; }
.rg-hotkey:hover { border-color: var(--accent); color: var(--text-primary); }
.rg-hotkey.listening { border-color: var(--accent); color: var(--accent); animation: rec-blink 1s steps(2, start) infinite; }
.rg-heading { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.rg-current { background: var(--bg-void); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.rg-current b { font-size: 14px; color: var(--text-primary); }
.rg-item { display: flex; align-items: center; gap: 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.rg-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg-void); }
.rg-thumb-generic { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.rg-item .rg-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.rg-icon { background: none; border: none; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.rg-icon:hover { background: var(--bg-hover); color: var(--text-secondary); }
.rg-icon.off { color: #ed4245; }
.go-pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 220px; }
.go-pos { aspect-ratio: 16/10; background: var(--bg-void); border: 2px solid var(--border); border-radius: 8px; cursor: pointer; position: relative; transition: border-color .12s; }
.go-pos:hover { border-color: var(--border-strong); }
.go-pos.active { border-color: var(--accent); }
.go-pos::after { content: ''; position: absolute; width: 30%; height: 26%; border-radius: 3px; background: var(--accent); opacity: .85; }
.go-pos[data-pos="tl"]::after { top: 5px; left: 5px; } .go-pos[data-pos="tr"]::after { top: 5px; right: 5px; }
.go-pos[data-pos="bl"]::after { bottom: 5px; left: 5px; } .go-pos[data-pos="br"]::after { bottom: 5px; right: 5px; }
.billing-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 48px 16px; color: var(--text-muted); }
.settings-content {
  flex: 1; overflow-y: auto; position: relative;
  background: var(--bg-modal);
}
/* Mobile settings: full-screen, with the sidebar turned into a horizontal
   scrollable tab strip so the content gets the whole screen width. */
@media (max-width: 768px) {
  .settings-overlay.open { align-items: stretch; justify-content: stretch; }
  .settings-modal-full {
    width: 100vw; height: 100vh; height: 100dvh;
    max-width: none; max-height: none; border-radius: 0;
    flex-direction: column;
  }
  .settings-sidebar {
    width: 100%; flex-direction: row; align-items: center;
    overflow-x: auto; overflow-y: hidden;
    gap: 6px; padding: 10px 12px;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
    scrollbar-width: none;
  }
  .settings-sidebar::-webkit-scrollbar { display: none; }
  .settings-sidebar .settings-nav-section,
  .settings-sidebar .settings-nav-sep,
  #settingsVersionBox { display: none; }
  #settingsSidebarUser {
    border-bottom: none; margin-bottom: 0; padding: 4px 6px; flex-shrink: 0;
  }
  #settingsSidebarUser > div:last-child { display: none; } /* keep the avatar, drop the name text */
  .settings-nav-item { flex-shrink: 0; white-space: nowrap; padding: 9px 12px; }
  .settings-content { flex: 1; min-height: 0; overflow-x: hidden; }
  .settings-content-inner { padding: 18px 16px 40px; overflow-x: hidden; }
  /* Two-column settings panes (form + sticky preview) must stack on a phone.
     The aside is flex-shrink:0 at 280px, so on a 390px screen it left the form
     about 54px and every hint line wrapped one word at a time. Inline styles
     set the width and position, hence the !important. */
  .settings-split { flex-direction: column; gap: 16px !important; }
  .settings-split-aside {
    width: 100% !important;
    position: static !important;
  }
  /* Stop wide form controls / cards from spilling past the screen edge. */
  .settings-content-inner input,
  .settings-content-inner textarea,
  .settings-content-inner select { max-width: 100%; box-sizing: border-box; }
  /* Keep the close button pinned and tappable while content scrolls. */
  .settings-content-inner .settings-close {
    position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; z-index: 20;
    width: 34px; height: 34px; background: var(--bg-elevated);
    border: 1px solid var(--border);
  }
  /* OPAQUE surfaces: a settings screen must never show the wallpaper / DM list through it.
     Core/custom-bg + glass make --bg-void/--bg-deep translucent, which caused the bleed. */
  .settings-modal-full, .settings-sidebar { background: #0e1015; }
  .settings-content { background: #14161d; }
  html[data-theme="light"] .settings-modal-full,
  html[data-theme="light"] .settings-sidebar { background: #e9ebf0; }
  html[data-theme="light"] .settings-content { background: #ffffff; }
  /* Top nav strip clears the notch/status bar; content clears the home indicator. */
  .settings-sidebar { padding-top: calc(env(safe-area-inset-top, 0px) + 10px); }
  .settings-content-inner { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  /* Flatten the nav "tree" into plain chips: the vertical connector lines + indents
     overlap and spill when the sidebar is laid out as a horizontal row. */
  .settings-sidebar .settings-nav-tree { display: contents; }
  .settings-sidebar .settings-nav-plabel { display: none; }
  .settings-sidebar .settings-nav-child { margin-left: 0; padding-left: 12px; font-size: 14px; }
  .settings-sidebar .settings-nav-child::before,
  .settings-sidebar .settings-nav-child::after { display: none; }
}
/* Animated aurora behind the Core/Quantum tab - applied to the full-height panel so
   it always fills, regardless of the tab's content height. Pure CSS (GPU-composited),
   and it only exists while the class is on (added on the upgrade tab, removed on leave). */
.settings-content.upgrade-aurora {
  background:
    radial-gradient(40% 50% at 18% 22%, rgba(123,65,242,.55), transparent 62%),
    radial-gradient(38% 46% at 82% 26%, rgba(81,222,248,.42), transparent 62%),
    radial-gradient(42% 48% at 62% 82%, rgba(215,79,68,.34), transparent 64%),
    radial-gradient(58% 62% at 42% 58%, rgba(70,38,140,.5),  transparent 72%),
    #090910;
  background-size: 180% 180%;
  animation: upgradeAurora 22s ease-in-out infinite;
}
@keyframes upgradeAurora {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 20% 80%; }
  33%  { background-position: 25% 30%, 75% 20%, 35% 70%, 45% 55%; }
  66%  { background-position: 10% 60%, 90% 45%, 60% 85%, 10% 70%; }
  100% { background-position: 0% 0%, 100% 0%, 50% 100%, 20% 80%; }
}
.settings-content-inner {
  padding: 36px 46px 64px;
  position: relative;
}
/* Consistent accent focus ring across every settings field (many use inline styles,
   so this catches them all without touching each one). */
.settings-content-inner input:focus,
.settings-content-inner textarea:focus,
.settings-content-inner select:focus { border-color: var(--accent) !important; outline: none; }
.settings-close {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.settings-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-tab-title { font-family: var(--font-display,'Space Grotesk',sans-serif); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 28px; }
.profile-card { background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; }
.profile-banner { height: 80px; background: linear-gradient(135deg, var(--accent), #7c3aed); position: relative; cursor: pointer; overflow: hidden; }
.profile-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-banner-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; opacity: 0; transition: opacity 0.15s; }
.profile-banner:hover .profile-banner-overlay { opacity: 1; }
.profile-card-body { padding: 0 16px 16px; display: flex; align-items: flex-end; gap: 14px; }
.profile-avatar-wrap { position: relative; cursor: pointer; margin-top: -28px; flex-shrink: 0; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--bg-surface); border: 4px solid var(--bg-deep); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-overlay { position: absolute; inset: 4px; border-radius: 50%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; opacity: 0; transition: opacity 0.15s; }
.profile-avatar-wrap:hover .profile-avatar-overlay { opacity: 1; }
.profile-names { padding-top: 8px; }
.profile-display-name { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.profile-tag { font-size: 12px; color: var(--text-muted); }
.settings-field-group { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; }
.settings-field { background: var(--bg-surface); padding: 17px 20px; }
.settings-field-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 8px; }
.settings-field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-field-value { font-size: 14px; color: var(--text-secondary); }
.settings-edit-btn { background: var(--bg-active); border: 1px solid var(--border-strong); color: var(--text-secondary); padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; transition: background 0.14s var(--ease-out,ease), color 0.14s, border-color 0.14s, filter 0.14s; }
.settings-edit-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Primary variant (accent-filled) brightens on hover instead of flipping colour. */
.settings-edit-btn[style*="var(--accent)"]:hover { filter: brightness(1.08); }
.settings-bio-input { width: 100%; background: var(--bg-deep); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-body,'DM Sans',sans-serif); font-size: 14px; padding: 8px 10px; resize: none; min-height: 60px; box-sizing: border-box; }
.settings-bio-input:focus { outline: none; border-color: var(--accent); }
/* Category drag */
.cat-drag-over { background: var(--bg-active); border-radius: var(--radius-sm); outline: 1px dashed var(--accent); }
