/* settings.css — AI-Do v4.0 Settings panel */

/* ===== Panel Layout ===== */
.settings-panel {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  gap: var(--space-md);
  overflow: hidden;
  height: 100%;
}

/* ===== Tab Bar ===== */
.settings-tab-bar {
  display: flex;
  gap: 2px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 3px;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-tab-bar::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  flex: 1;
  min-width: 0;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

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

.settings-tab.active {
  background: var(--accent-primary);
  color: #fff;
}

/* ===== Tab Content ===== */
.settings-tab-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.settings-tab-content::-webkit-scrollbar {
  width: 4px;
}

.settings-tab-content::-webkit-scrollbar-track {
  background: transparent;
}

.settings-tab-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}

/* ===== Section Card ===== */
.settings-section {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 0;
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal);
}

.settings-section:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
}

/* ===== Section Title ===== */
.settings-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.settings-section-title svg {
  color: var(--accent-primary-light);
  flex-shrink: 0;
}

/* ===== Field Layout ===== */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.settings-field:last-child {
  margin-bottom: 0;
}

.settings-field-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.settings-field-hint {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  line-height: var(--line-height-normal);
}

.settings-field-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

/* ===== Toggle Switch ===== */
.settings-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--glass-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.settings-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: all var(--transition-fast);
}

.settings-toggle.active {
  background: var(--accent-primary);
}

.settings-toggle.active::after {
  transform: translateX(20px);
}

.settings-toggle:hover {
  opacity: 0.9;
}

/* ===== Select Dropdown ===== */
.settings-select {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-sm) center;
  padding-right: var(--space-xl);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

[data-theme="light"] .settings-select {
  background-color: rgba(255, 255, 255, 0.6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(26,26,46,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.settings-select:hover {
  border-color: var(--glass-border-light);
}

.settings-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.settings-select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ===== Range Input ===== */
.settings-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--glass-border);
  border-radius: var(--radius-full);
  outline: none;
  transition: background var(--transition-fast);
}

.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
  transition: transform var(--transition-fast);
}

.settings-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.settings-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

/* ===== Badge ===== */
.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--glass-bg-active);
  border: 1px solid var(--glass-border);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== Save Bar ===== */
.settings-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border-top: 1px solid var(--glass-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  z-index: var(--z-sticky);
}

/* ===== Version Display ===== */
.settings-version {
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  text-align: center;
  margin-top: auto;
  padding-top: var(--space-md);
}

/* ===== Color Swatch ===== */
.settings-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--glass-border);
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
}

.settings-color-swatch:hover {
  border-color: var(--glass-border-light);
}

/* ===== Font Size Selector ===== */
.settings-font-size-group {
  display: flex;
  gap: 2px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.settings-font-size-option {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  cursor: pointer;
  text-align: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.settings-font-size-option:hover {
  color: var(--text-primary);
}

.settings-font-size-option.active {
  background: var(--accent-primary);
  color: #fff;
}

/* ===== Masked Token Field ===== */
.settings-token-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

[data-theme="light"] .settings-token-field {
  background: rgba(255, 255, 255, 0.6);
}

/* ===== Range Value Display ===== */
.settings-range-value {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--accent-primary-light);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .settings-panel {
    padding: var(--space-md);
    gap: var(--space-sm);
  }

  .settings-section {
    padding: var(--space-md);
  }

  .settings-field-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-tab {
    font-size: var(--font-size-xs);
    padding: var(--space-xs) 6px;
  }
}
