/* Cassandra — settings page: rows, selects, dropzone, invite block,
 * user menu dropdown, import preview, action buttons. */

/* Settings-page action button — same visual language as .pf-actions
   button so buttons across /settings (Manage subscription, future
   actions) read as one family. Standalone class (not nested under a
   parent) so it can be dropped onto any button anywhere on the page. */
.settings-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 7px 14px;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
  display: inline-block;
}
.settings-btn:hover { border-color: var(--accent); }
.settings-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Icon-button variant for inline row actions (e.g. Manage subscription
   gear in the Tier row). Square hit area, accent on hover, tooltip via
   title attribute. */
.settings-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
  transition: color 80ms linear, border-color 80ms linear, background 80ms linear;
}
.settings-icon-btn:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--surface-2);
}
.settings-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.settings-icon-btn svg { display: block; }

/* --- Settings page --------------------------------------------------- */

.settings-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-2);
  font-size: 13px;
}
.settings-row__label {
  width: 110px;
  flex-shrink: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  font-family: var(--font-mono);
}
.settings-row__value { color: var(--text); }
.settings-row__hint {
  color: var(--dim);
  font-size: 11px;
  margin-left: 8px;
}

/* Terminal-aesthetic <select> used in the Settings page. Native
 * browser chrome stripped; we render a small chevron via crossed
 * linear-gradients so the control matches the rest of the panel. */
.settings-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 28px 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(-45deg, transparent 50%, var(--dim) 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 120ms ease-out, color 120ms ease-out;
}
.settings-select:hover,
.settings-select:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
}
.settings-select option { color: var(--text); background: var(--surface); }
.settings-select option:disabled { color: var(--dim); }

.settings-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.settings-status:empty { display: none; }

/* Sections are <details> elements — collapsed by default to keep the
   settings page scannable. Click the summary to expand. */
.settings-section {
  margin-top: 14px;
  border-top: 1px solid var(--surface-2);
  padding-top: 14px;
}
.settings-section__head {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
/* Suppress the native disclosure marker (Webkit + Firefox). */
.settings-section__head::-webkit-details-marker { display: none; }
.settings-section__head::marker { content: ""; }
.settings-section__head::before {
  content: "▸";
  color: var(--accent);
  display: inline-block;
  transition: transform 120ms ease-out;
  font-size: 10px;
}
.settings-section[open] > .settings-section__head::before {
  transform: rotate(90deg);
}
.settings-section[open] > .settings-section__head { margin-bottom: 10px; }
.settings-section__head:hover { color: var(--text); }
.settings-section__head:hover::before { color: var(--text); }
.settings-section__lede {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0 0 14px;
}
.settings-section__lede strong { color: var(--positive); font-weight: 600; }

.invite-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 14px 16px;
}
.invite-block__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.invite-block__label:not(:first-child) { margin-top: 12px; }
.invite-block__code {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.32em;
  color: var(--accent);
  background: var(--surface);
  padding: 10px 14px;
  border: 1px solid var(--accent);
  text-align: center;
  user-select: all;
}
.invite-block__link {
  display: flex;
  gap: 6px;
}
.invite-block__link input {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.invite-block__link button {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.invite-block__link button:hover { opacity: 0.85; }

.invite-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 16px;
}
.invite-stats > div {
  background: var(--surface);
  padding: 10px 14px;
}
.invite-stats__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.invite-stats__value {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

/* Import preview action row — two stacked buttons with an explainer. */
.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.import-choice { flex: 1 1 240px; min-width: 220px; }
.import-choice button { width: 100%; }
.import-choice .settings-row__hint {
  display: block;
  margin-top: 6px;
  line-height: 1.5;
}

/* User chip in header — now a button that toggles a dropdown menu. */
.user-menu { position: relative; margin-left: 8px; }
.user-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.user-chip:hover { color: var(--accent); }
.user-menu__caret { margin-left: 4px; opacity: 0.6; }
.user-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  z-index: 200;
  padding: 4px 0;
}
.user-menu__item {
  display: block;
  padding: 8px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}
.user-menu__item:hover { background: var(--surface-2); color: var(--accent); }

/* --- Upload / import drag-drop zone (settings page) ------------------ */

.dz {
  border: 2px dashed var(--border);
  background: var(--surface-2);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dz:hover, .dz--over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
}
.dz__icon {
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -2px;
  margin-bottom: 6px;
}
.dz__label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dz__hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.dz__hint a { color: var(--accent); }
.dz__filename { margin-top: 10px; color: var(--accent); font-size: 12px; font-family: var(--font-mono); min-height: 1em; }


.result {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  font-family: var(--font-sans);
  font-size: 13px;
}
.result--err { border-left-color: var(--negative); background: color-mix(in srgb, var(--negative) 5%, transparent); }
.result__head {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}
.result--err .result__head { color: var(--negative); }
.result__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 18px;
  margin-bottom: 10px;
}
.result__grid .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.result__grid .v { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 2px; }
.result__grid .v.pos { color: var(--positive); }
.result__grid .v.neg { color: var(--negative); }
.result__row { color: var(--muted); font-size: 12px; margin-top: 6px; }
.result__warn { color: var(--alert); font-size: 12px; margin-top: 4px; }
.result__warn code { background: rgba(0,0,0,0.15); padding: 1px 4px; font-family: var(--font-mono); }

/* --- Modal text inputs (cloud-sync PIN modal, etc.) ---------------- */
/* Same visual treatment as auth-card so prompts read as a coherent
   family. Replaces the inline `style="padding:8px"` that left these
   inputs feeling cramped. */
.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  outline: none;
  border-radius: 3px;
  box-sizing: border-box;
}
.modal-input:focus { border-color: var(--accent); }


/* --- Mobile (≤480px) -------------------------------------------------- */

@media (max-width: 480px) {
  /* Form rows stack: label above value instead of side-by-side. The
     desktop layout uses a fixed 110px label column that pinches the
     value column unbearably on a phone. */
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 0;
  }
  .settings-row__label {
    width: auto;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .settings-select {
    width: 100%;
    font-size: 14px;     /* avoids iOS Safari zoom-on-focus */
  }

  /* The two-column import picker becomes single column. */
  .import-choice {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Buttons get a full-width tap target. */
  .settings-btn { width: 100%; padding: 10px; }
  .settings-icon-btn { width: 100%; justify-content: center; }
}
