/* ML Setup Page - 3-Step Onboarding Wizard */

.page {
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.header {
  margin-bottom: 2rem;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 0 2rem;
}

.stepItem {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.stepItem:hover {
  background: var(--color-bg-hover);
}

.stepCircle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  transition: all 0.2s;
  flex-shrink: 0;
}

.stepActive .stepCircle {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.stepCompleted .stepCircle {
  border-color: #22c55e;
  background: #22c55e;
  color: white;
}

.stepLabel {
  font-weight: 500;
}

.stepActive .stepLabel {
  color: var(--color-text);
  font-weight: 600;
}

.stepCompleted .stepLabel {
  color: #22c55e;
}

.stepConnector {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  min-width: 40px;
  max-width: 120px;
  transition: background 0.3s;
}

.stepConnectorActive {
  background: #22c55e;
}

/* Step Content */
.stepContent {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.stepTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.stepDescription {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Form elements */
.formGroup {
  margin-bottom: 1.25rem;
}

.formLabel {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.formHint {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.fileInput {
  display: none;
}

.fileDropZone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--color-bg);
}

.fileDropZone:hover {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.05);
}

.fileDropZoneActive {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.fileDropIcon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
}

.fileDropText {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.fileDropName {
  font-size: 0.875rem;
  color: #22c55e;
  font-weight: 500;
}

.numberInput {
  width: 120px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.875rem;
}

.numberInput:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.textInput {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.875rem;
}

.textInput:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Algorithm selection grid */
.algorithmGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.algorithmCard {
  padding: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--color-bg);
}

.algorithmCard:hover {
  border-color: var(--color-text-secondary);
}

.algorithmCardSelected {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.05);
}

.algorithmHeader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.algorithmDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.algorithmName {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.algorithmDesc {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Device selector */
.deviceSelector {
  display: flex;
  gap: 0.75rem;
}

.deviceOption {
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.deviceOption:hover {
  border-color: var(--color-text-secondary);
}

.deviceOptionSelected {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
  color: var(--color-primary);
}

/* Decision entries */
.decisionList {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.decisionCard {
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.decisionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.decisionNumber {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.removeBtn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-size: 0.75rem;
}

.removeBtn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.decisionFields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.addBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  transition: all 0.2s;
  width: 100%;
  margin-top: 0.75rem;
}

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

/* Progress bar */
.progressContainer {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.progressHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.progressLabel {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.progressPercent {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
}

.progressBar {
  height: 8px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progressFill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progressFillComplete {
  background: #22c55e;
}

.progressFillFailed {
  background: #ef4444;
}

.progressMessage {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Actions */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.actionsLeft {
  display: flex;
  gap: 0.75rem;
}

.actionsRight {
  display: flex;
  gap: 0.75rem;
}

.btnPrimary {
  padding: 0.625rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btnPrimary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btnPrimary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btnSecondary {
  padding: 0.625rem 1.5rem;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btnSecondary:hover:not(:disabled) {
  background: var(--color-bg-hover);
}

.btnSecondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btnSuccess {
  padding: 0.625rem 1.5rem;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btnSuccess:hover:not(:disabled) {
  background: #16a34a;
}

.btnSuccess:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error alert */
.errorAlert {
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #ef4444;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.errorDismiss {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  line-height: 1;
}

/* Success card */
.successCard {
  text-align: center;
  padding: 2rem;
}

.successIcon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.successTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.successMessage {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.downloadBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.downloadBtn:hover {
  opacity: 0.9;
}

/* Select */
.selectInput {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.875rem;
  width: 100%;
}

.selectInput:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Model ref row */
.modelRefRow {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Skip banner */
.skipBanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
}

.skipBannerText {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.skipBannerText strong {
  color: var(--color-text);
}

/* Data source banner */
.dataSourceBanner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text);
}

.dataSourceBanner code {
  font-size: 0.8rem;
  padding: 0.1rem 0.4rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  font-family: monospace;
}

/* Responsive */
@media (max-width: 768px) {
  .page {
    padding: 1rem;
  }

  .stepper {
    padding: 0;
    overflow-x: auto;
  }

  .algorithmGrid {
    grid-template-columns: 1fr;
  }

  .decisionFields {
    grid-template-columns: 1fr;
  }

  .skipBanner {
    flex-direction: column;
    text-align: center;
  }

  .actions {
    flex-direction: column;
  }

  .actionsLeft,
  .actionsRight {
    width: 100%;
  }

  .actionsRight {
    justify-content: flex-end;
  }
}

/* ============================================================
   Advanced Settings
   ============================================================ */
.advancedSection {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.advancedToggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s;
}

.advancedToggle:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.advancedContent {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

.advancedGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.advancedGroupTitle {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.advancedGroupTitle:first-child {
  margin-top: 0;
}
