/* ============================================
   Settings Page
   ============================================ */

.settings-page {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-6);
}

@media (min-width: 1600px) {
  .settings-page { max-width: 780px; }
  .settings-card { padding: var(--space-6); }
  .settings-header h1 { font-size: 1.5rem; }
}

.settings-header {
  margin-bottom: var(--space-6);
}

.settings-header h1 {
  margin: 0 0 var(--space-1) 0;
}

.settings-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.settings-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.settings-card h2 {
  margin: 0 0 var(--space-4) 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.settings-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-help {
  margin: var(--space-1) 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Toggle Switch ── */
.settings-theme-toggle {
  position: relative;
  background: none !important;
  border: none !important;
  padding: 0;
  cursor: pointer;
  outline: none !important;
  box-shadow: none !important;
}

.settings-theme-toggle:hover {
  background: none !important;
}

.settings-theme-toggle:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 4px;
  border-radius: 4px;
}

.toggle-track {
  display: flex;
  align-items: center;
  width: 56px;
  height: 30px;
  border-radius: 15px;
  background: var(--gray-300);
  position: relative;
  transition: background-color 0.25s ease;
  overflow: hidden;
}

.settings-theme-toggle--active .toggle-track {
  background: var(--blue-600);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.settings-theme-toggle--active .toggle-thumb {
  transform: translateX(26px);
}

.toggle-icons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 7px;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.toggle-icon-sun,
.toggle-icon-moon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  transition: opacity 0.2s ease;
}

.toggle-icon-sun { opacity: 1; }
.toggle-icon-moon { opacity: 0.6; }

.settings-theme-toggle--active .toggle-icon-sun { opacity: 0.6; }
.settings-theme-toggle--active .toggle-icon-moon { opacity: 1; }

/* ── Session Section ── */
.settings-card--session {
  background: var(--card-bg);
}

.settings-session-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px dashed var(--border-color);
}

.settings-session-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-session-item-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.settings-session-icon {
  display: flex;
  align-items: center;
  color: var(--text-tertiary, var(--text-secondary));
}

.settings-token-expired {
  color: var(--danger) !important;
  font-weight: 600;
}

/* ── Dark mode ── */
:root[data-theme='dark'] .toggle-track {
  background: var(--gray-700);
}

:root[data-theme='dark'] .settings-theme-toggle--active .toggle-track {
  background: var(--blue-600);
}

:root[data-theme='dark'] .toggle-thumb {
  background: #e2e8f0;
}

@media (max-width: 580px) {
  .settings-page {
    padding: var(--space-4);
  }

  .settings-session-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
}