/* ==============================================================
   settings.css - Settings page styles
   ============================================================== */

/* ===== SETTINGS PAGE LAYOUT ===== */
#page-settings .analytics-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* Settings page has filter bar visible (holds page nav), so use standard page padding */
#page-settings {
  padding-top: var(--header-h);
}

#page-settings .analytics-section {
  padding-top: 24px;
}

.settings-page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.settings-page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 32px;
}

/* ===== SETTINGS SECTION ===== */
.settings-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.settings-section-desc {
  font-size: 13px;
  color: var(--text-2);
  padding: 14px 20px 0;
  line-height: 1.5;
}

/* ===== SETTINGS ROW ===== */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}

.settings-row:first-of-type { border-top: none; }
.settings-section-desc + .settings-row { border-top: none; }

.settings-row:hover { background: rgba(255,255,255,0.015); }

.settings-row-info {
  flex: 1;
  min-width: 0;
}

.settings-row-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.settings-row-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}

/* ===== TOGGLE SWITCH ===== */
.settings-toggle {
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.settings-toggle input { display: none; }

.settings-toggle-track {
  display: flex;
  align-items: center;
  width: 42px;
  height: 24px;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 2px;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.settings-toggle input:checked + .settings-toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.settings-toggle-thumb {
  width: 18px;
  height: 18px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
  flex-shrink: 0;
}

.settings-toggle input:checked + .settings-toggle-track .settings-toggle-thumb {
  transform: translateX(18px);
  background: var(--bg);
}

/* ===== COLOR SWATCHES ===== */
.settings-color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .settings-color-swatches {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    justify-content: flex-start;
    /* full width so it scrolls within the section rather than pushing past it */
    width: 100%;
    padding-bottom: 4px;
    /* hide scrollbar visually but keep it functional */
    scrollbar-width: none;
  }
  .settings-color-swatches::-webkit-scrollbar { display: none; }
  /* prevent swatches from shrinking below their natural size */
  .settings-color-swatches .settings-swatch { flex-shrink: 0; }
}

.settings-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-4);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.settings-swatch:hover {
  border-color: var(--swatch-color);
  color: var(--text);
  background: var(--bg-3);
}

.settings-swatch.active {
  border-color: var(--swatch-color);
  color: var(--text);
  background: color-mix(in srgb, var(--swatch-color) 10%, var(--bg-3));
}

.swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--swatch-color);
  flex-shrink: 0;
}

/* ===== SEGMENTED CONTROL ===== */
.settings-segmented {
  display: flex;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.settings-seg-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.settings-seg-btn:hover { color: var(--text); }
.settings-seg-btn.active {
  background: var(--bg-2);
  color: var(--accent);
  border: 1px solid var(--border-light);
}

/* ===== SAVE ROW ===== */
.settings-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 8px;
  padding: 0 2px 2px;
}

.settings-save-status {
  font-size: 13px;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s, transform 0.3s;
}

.settings-save-status.visible {
  opacity: 1;
  transform: translateY(0);
}

.settings-save-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 14px;
}

.settings-save-btn.saved {
  opacity: 0.7;
  transform: scale(0.97);
}

/* ===== COLOR BLIND MODE CSS OVERRIDES ===== */
.colorblind-mode {
  --accent: #4a9eff;
  --accent-dim: rgba(74, 158, 255, 0.14);
  --red: #e07b00;
  --red-dim: rgba(224, 123, 0, 0.13);
  /* Keep amber for neutral warning */
  --amber: #b59000;
  --amber-dim: rgba(181, 144, 0, 0.13);
}

/* Colorblind: override colored status badges with shape indicators */
.colorblind-mode .status-badge.active::before    { content: '■ '; font-size: 9px; }
.colorblind-mode .status-badge.at-risk::before   { content: '▲ '; font-size: 9px; }
.colorblind-mode .status-badge.inactive::before  { content: '● '; font-size: 9px; }
.colorblind-mode .session-balance-badge.balance-funded::before { content: '✓ '; font-size: 9px; }
.colorblind-mode .session-balance-badge.balance-empty::before  { content: '✕ '; font-size: 9px; }

/* ===== FONT SIZE CSS VAR APPLICATION ===== */
/* Font size is applied directly to body via JS (_applyFontScale).
   These selectors ensure child elements inherit cleanly. */
.client-card,
.stat-chip,
.filter-input,
.filter-select,
.analytics-body,
.schedule-section,
.funnel-section {
  font-size: inherit;
}

/* ===== SETTINGS ROW WRAP VARIANT (for swatch row on small screens) ===== */
.settings-row-wrap {
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== RADIUS CSS VAR APPLICATION ===== */
/* These are already handled by overriding --radius and --radius-lg on :root */

/* ===== SETTINGS NAV DIVIDER ===== */
.page-nav-option.settings-nav-option {
  border-top: 1px solid var(--border-light) !important;
  margin-top: 2px;
  color: var(--text-2);
}

.page-nav-option.settings-nav-option:hover { color: var(--text); }
