/* ============================================
   WHISPR — Settings Screens (ChatGPT Style)
   Used by: settings.html, agent-settings.html
   ============================================ */

.settings-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-primary);
  overflow: hidden;
}

/* --- Settings Header --- */
.settings-header {
  flex-shrink: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--separator);
  padding-top: var(--sat);
}

.settings-header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 52px;
}

.settings-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.settings-header__back:hover { background: var(--bg-hover); }
.settings-header__back svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

.settings-header__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* --- Settings List --- */
.settings-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + var(--sab));
}

/* --- Settings Group --- */
.settings-group { margin-bottom: 24px; }

.settings-group__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 16px 16px 8px;
}

/* --- Settings Row --- */
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-primary);
  cursor: pointer;
  transition: background 0.1s ease;
}

.settings-row:hover { background: var(--bg-hover); }
.settings-row + .settings-row { border-top: 1px solid var(--separator); }

.settings-row__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

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

.settings-row__label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-row__value {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-row__chevron {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* --- Settings Input --- */
.settings-input {
  padding: 14px 16px;
  border-top: 1px solid var(--separator);
}

.settings-input__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.settings-input__field {
  width: 100%;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
}

.settings-input__field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.settings-input__field::placeholder { color: var(--text-tertiary); }

.settings-input__hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* --- Textarea variant --- */
.settings-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
}

.settings-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* --- Save Button --- */
.settings-save-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 16px auto;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.1s ease, background 0.15s ease;
}

.settings-save-btn:hover { background: var(--accent-dim); }
.settings-save-btn:active { opacity: 0.7; }

/* --- Status Badge --- */
.settings-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}

.settings-status--ok { background: var(--accent-light); color: var(--accent); }
.settings-status--warn { background: #fff3cd; color: #856404; }

.settings-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- About Section --- */
.settings-about {
  text-align: center;
  padding: 32px 16px;
}

.settings-about__logo { font-size: 32px; margin-bottom: 8px; }

.settings-about__name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-about__version {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* --- Toggle Switch --- */
.settings-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

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

.settings-toggle input:checked + .settings-toggle__slider::before {
  transform: translateX(20px);
}

/* --- Agent Card (agent-settings.html) --- */
.agent-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px;
}

.agent-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.agent-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.agent-card__name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-card__role {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .settings-header__inner { padding: 10px 12px; }
  .settings-header__title { font-size: 18px; }
  .settings-row { padding: 12px; }
}
