/* ==========================================================================
   Settings Page Styles
   Loaded ONLY by settings.html — do not reference these classes elsewhere.
   ========================================================================== */

/* Header — flex row with title+subtitle on left, save/cancel buttons on right */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.title h1 {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

/* Save / Cancel buttons in the page header */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ==========================================================================
   Settings Grid
   Two-column card layout for the settings sections (Account | Preferences | etc.).
   Renamed from .grid to .settings-grid to avoid collision with the shared
   2-column form .grid defined in components.css.
   DEPENDENCY: settings.html must use class="settings-grid" on the <section>.
   At ≤1100px collapses to a single column.
   ========================================================================== */

.settings-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ==========================================================================
   Card Helpers
   Sections within each settings card — top header bar and body content area.
   ========================================================================== */

.card-top {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-top h3 {
  font-size: 16px;
  font-weight: 850;
}

.card-body {
  padding: 20px 18px 22px;
}

/* Vertical stack of form fields or toggle rows */
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   Toggle Switch
   Custom CSS toggle used for boolean settings (e.g. Account Enabled).
   JavaScript in settings.js manages the .on class and aria-checked attribute.
   ========================================================================== */

/* Row containing a label + switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
}

/* The pill-shaped track of the switch */
.switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  cursor: pointer;
  flex: none;
}

/* The circular thumb — positioned via left: 4px (off) or left: 26px (on) */
.switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  transition: left 0.16s ease, background-color 0.16s ease;
}

/* On state: teal track + teal thumb, thumb slides to the right */
.switch.on {
  background: rgba(45, 189, 177, 0.18);
  border-color: rgba(45, 189, 177, 0.35);
}

.switch.on::after {
  left: 26px;
  background: rgba(45, 189, 177, 0.95);
}

/* ==========================================================================
   Account Card
   Avatar + name/email fields laid out side by side.
   ========================================================================== */

.account {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
}

/* Circular avatar container — shows either an uploaded photo or initials fallback */
.avatar {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

/* Photo — hidden by default; shown when a data URL is set via JS */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

/* Initials fallback — shown when no photo is uploaded */
.avatar .fallback {
  font-weight: 900;
  font-size: 20px;
  opacity: 0.9;
}

/* Upload + Remove photo buttons */
.upload-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Hidden file input — triggered programmatically by the Upload button click */
.file {
  display: none;
}

/* ==========================================================================
   AI Consent Modal — list of bullet-point terms inside the consent dialog.
   Reuses the shared .modal / .modal-backdrop / .modal-actions from components.css.
   ========================================================================== */

.consent-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.consent-list li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: collapse settings grid to single column */
@media (max-width: 1100px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Small tablet: stack page header vertically */
@media (max-width: 780px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
