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

.settings-section {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section-title .icon {
  font-size: 18px;
}

/* ========== Provider Cards ========== */

#providerList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.provider-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  transition: border-color 0.15s;
}

.provider-card.is-default {
  border-color: var(--primary);
  background: var(--primary-light);
}

.provider-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.provider-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.provider-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-model {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-card-url {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.provider-card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  line-height: 1;
}

.provider-card-actions button:hover {
  background: var(--bg-hover);
}

.provider-star-btn {
  color: var(--text-muted);
}

.provider-star-btn.active {
  color: #f59e0b;
}

.settings-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* ========== Provider Form ========== */

.provider-form-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.settings-form-group {
  margin-bottom: 12px;
}

.settings-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.settings-form-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
}

.settings-form-group input:focus {
  border-color: var(--primary);
}

.preset-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.preset-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.preset-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.provider-form-actions {
  display: flex;
  gap: 8px;
}

.provider-form-actions .btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.provider-form-actions .btn-primary {
  background: var(--primary);
  color: #fff;
}

.provider-form-actions .btn-primary:hover {
  background: var(--primary-dark);
}

.provider-form-actions .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.provider-form-actions .btn-secondary:hover {
  background: var(--bg-hover);
}

/* ========== Data Management ========== */

.data-btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.data-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  justify-content: center;
  min-width: 140px;
}

.data-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.data-btn .data-icon {
  font-size: 18px;
}

/* ========== Report ========== */

.report-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.report-controls input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
}

.report-controls input[type="date"]:focus {
  border-color: var(--primary);
}

.report-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.report-btn-primary {
  background: var(--primary);
  color: #fff;
}

.report-btn-primary:hover {
  background: var(--primary-dark);
}

.report-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.report-btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.report-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.report-preview {
  width: 100%;
  min-height: 240px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-secondary);
  resize: vertical;
  outline: none;
}

.report-preview:focus {
  border-color: var(--primary);
}

.report-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ========== Extension Toggles ========== */

.ext-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ext-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.ext-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ext-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.ext-item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* iOS-style toggle */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

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

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

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

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

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

/* ========== About ========== */

.about-info {
  text-align: center;
  padding: 10px 0;
}

.about-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.about-version {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.about-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
  .settings-section {
    padding: 16px;
    border-radius: var(--radius);
  }

  .data-btn-row {
    flex-direction: column;
  }

  .data-btn {
    flex: none;
  }

  .report-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .report-controls input[type="date"] {
    width: 100%;
  }
}

@media (min-width: 769px) {
  #page-settings {
    max-width: 680px;
    margin: 0 auto;
  }
}
