/* =========================================================
   VIEW: Settings
   ========================================================= */

.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-lg);
  height: 100%;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  height: fit-content;
  position: sticky;
  top: var(--space-sm);
}

.settings-nav-item {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.settings-nav-item.is-active {
  color: var(--text-primary);
  background: var(--bg-hover);
  font-weight: 600;
}

.settings-nav-item.danger {
  color: var(--accent-red);
  margin-top: var(--space-md);
}

.settings-nav-item.danger:hover {
  background: var(--accent-red-dim);
}

.settings-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  min-height: 500px;
}

.settings-section h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.settings-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Theme selector */
.theme-selector {
  display: flex;
  gap: var(--space-sm);
}

.theme-option {
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  min-width: 80px;
}

.theme-option:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.theme-option.is-active {
  border-color: var(--accent-blue);
  color: var(--text-primary);
  background: rgba(43, 106, 255, 0.1);
}

/* Timeframe selector */
.timeframe-selector {
  display: flex;
  gap: 2px;
  background: var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.timeframe-selector button {
  padding: var(--space-xs) var(--space-sm);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeframe-selector button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.timeframe-selector button.is-active {
  color: var(--text-primary);
  background: var(--bg-hover);
  font-weight: 600;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-hover);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-blue);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* Notification items */
.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
  border-bottom: none;
}

/* Security cards */
.security-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.security-card h3 {
  margin-bottom: var(--space-sm);
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}

/* API Keys */
.api-key-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

/* Danger Zone */
.danger-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  background: var(--bg-primary);
  border: 1px solid var(--accent-red-dim);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.danger-card h3 {
  color: var(--accent-red);
}

/* Responsive */
@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
  }
}
