/* ===== Settings Page Layout ===== */
.settings-page {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.settings-header__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-header__title h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 0;
  background: linear-gradient(135deg, var(--color-accent-start), var(--color-accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.settings-header__back {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.settings-header__back:hover {
  color: var(--color-accent-start);
  background: var(--color-surface-muted);
}

.settings-header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.settings-header__user {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ===== Settings Layout ===== */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* ===== Settings Section ===== */
.settings-section {
  background: var(--color-surface);
  border-radius: 0.75rem;
  border: 1px solid var(--color-border-subtle);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-section__header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  color: var(--color-text-primary);
}

.settings-section__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Exchange Toggles ===== */
.exchange-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exchange-toggles__loading {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
}

.exchange-toggle-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface-muted);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.exchange-toggle-card:hover {
  background: rgba(148, 163, 184, 0.1);
}

.exchange-toggle-card.disabled {
  opacity: 0.6;
}

.exchange-toggle-card__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--color-surface);
  flex-shrink: 0;
}

.exchange-toggle-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.exchange-toggle-card__name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.exchange-toggle-card__status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.exchange-toggle-card__status.enabled {
  color: var(--color-success);
}

.exchange-toggle-card__status.disabled-status {
  color: var(--color-warning);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.toggle-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(148, 163, 184, 0.3);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-switch__slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-switch__slider {
  background: linear-gradient(135deg, var(--color-accent-start), var(--color-accent-end));
}

.toggle-switch input:checked + .toggle-switch__slider:before {
  transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-switch__slider {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* ===== Settings Actions ===== */
.settings-actions {
  display: flex;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-subtle);
}

.settings-actions .btn-primary,
.settings-actions .btn-secondary {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.95rem;
}

.settings-actions .btn-primary {
  background: linear-gradient(135deg, var(--color-accent-start), var(--color-accent-end));
  color: white;
}

.settings-actions .btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.settings-actions .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-actions .btn-secondary {
  background: rgba(148, 163, 184, 0.1);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
}

.settings-actions .btn-secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

/* ===== Settings Message ===== */
.settings-message {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  display: none;
}

.settings-message.visible {
  display: block;
}

.settings-message.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.settings-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .settings-page {
    padding: 0.75rem;
  }

  .settings-section {
    padding: 1rem;
  }

  .exchange-toggle-card {
    padding: 0.75rem;
  }

  .exchange-toggle-card__logo {
    width: 32px;
    height: 32px;
  }

  .settings-actions {
    flex-direction: column;
  }

  .settings-actions .btn-primary,
  .settings-actions .btn-secondary {
    width: 100%;
  }
}
