/**
 * BASECAMP WIZARD UI SYSTEM — Liquid Glass Installation
 * ======================================================
 * 
 * State-of-the-art, minimal, generous, liquid glass style
 * Consistent across all 4 installation steps
 * 
 * Components:
 * - .wizard-shell        (Card + header + lang toggle)
 * - .wizard-step-header  (Title, step count, progress)
 * - .wizard-form         (Vertical stack)
 * - .wizard-row          (2-col grid)
 * - .wizard-field        (Label + input + help/error)
 * - .wizard-actions      (Buttons)
 * 
 * @requires tokens.css
 * @requires auth-shell.css (for background)
 */

/* ============================================================================
   WIZARD SHELL — Main Container Card
   ============================================================================ */

.wizard-shell {
  position: relative;
  width: min(var(--wizard-max-width), 94vw);
  padding: var(--wizard-padding);
  border-radius: var(--wizard-radius);
  
  /* Premium Liquid Glass */
  background: rgb(90 103 117 / 30%);
  border: 1px solid rgb(255 255 255 / 15%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
}

/* Backdrop-filter fallback */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .wizard-shell {
    background: rgba(20, 20, 28, 0.92);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

/* ============================================================================
   WIZARD HEADER — Installation + Basecamp Core Platform
   ============================================================================ */

.wizard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--wizard-gap-header);
}

.wizard-header-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  color: #ffffff;
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-2) 0;
}

.wizard-header-subtitle {
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Compact Header for Auth Pages */
.wizard-header--compact {
  margin-bottom: var(--wizard-gap-field);
}

.wizard-header--compact .wizard-header-title {
  font-size: var(--text-2xl);
}

.wizard-header--compact .wizard-header-subtitle {
  font-size: var(--text-sm);
}

/* ============================================================================
   LANGUAGE TOGGLE — Top Right
   ============================================================================ */

.wizard-lang-toggle {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  display: flex;
  padding: var(--space-1);
  gap: var(--space-0-5, 2px);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.wizard-lang-btn {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  transition: all 150ms ease;
  line-height: 1;
}

.wizard-lang-btn:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
}

.wizard-lang-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* ============================================================================
   STEP HEADER — Step Name + "Step X of 4" + Progress
   ============================================================================ */

.wizard-step-header {
  margin-bottom: var(--space-2);
}

.wizard-step-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.wizard-step-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: #ffffff;
  letter-spacing: normal;
  margin: 0;
}

.wizard-step-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.wizard-step-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.wizard-step-count {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.5);
}

/* Progress Bar */
.wizard-progress {
  width: 100%;
  height: var(--wizard-progress-height);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--wizard-progress-radius);
  overflow: hidden;
}

.wizard-progress-bar {
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--wizard-progress-radius);
  transition: width 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================================
   STEP DESCRIPTION — Helper Text
   ============================================================================ */

.wizard-step-description {
  font-size: var(--text-sm);
  color: rgb(255 255 255 / 80%);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--wizard-gap-group) 0;
}

/* ============================================================================
   WIZARD FORM — Vertical Stack Container
   ============================================================================ */

.wizard-form {
  display: flex;
  flex-direction: column;
  gap: var(--wizard-gap-field);
}

/* ============================================================================
   WIZARD ROW — 2-Column Grid
   ============================================================================ */

.wizard-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--wizard-gap-field);
}

/* Mobile: Stack columns */
@media (max-width: 600px) {
  .wizard-row {
    grid-template-columns: 1fr;
  }
}

/* Special: Host/Port split (3:1) */
.wizard-row--host-port {
  grid-template-columns: 1fr 120px;
}

@media (max-width: 600px) {
  .wizard-row--host-port {
    grid-template-columns: 1fr;
  }
}

/* License Row: Input + Check Button */
.wizard-row--license {
  grid-template-columns: 1fr auto;
}

.wizard-row--license .wizard-field--btn {
  min-width: 180px;
}

@media (max-width: 600px) {
  .wizard-row--license {
    grid-template-columns: 1fr;
  }
  .wizard-row--license .wizard-field--btn {
    min-width: auto;
  }
}

/* ============================================================================
   WIZARD FIELD — Label + Input + Helper/Error
   ============================================================================ */

.wizard-field {
  display: flex;
  flex-direction: column;
  gap: var(--wizard-gap-label);
}

.wizard-field-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1;
}

.wizard-field-input {
  width: 100%;
  height: var(--wizard-input-height);
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--wizard-input-radius);
  accent-color: rgba(255, 255, 255, 0.5);
  caret-color: #ffffff;
  transition: 
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.wizard-field-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.wizard-field-input:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.wizard-field-input:focus {
  outline: none;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* Text Selection */
.wizard-field-input::selection,
.wizard-shell input::selection,
.wizard-shell ::selection {
  background: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.wizard-field-input::-moz-selection,
.wizard-shell input::-moz-selection {
  background: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Helper Text */
.wizard-field-help {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.4;
  margin: 0;
}

/* Error State (uses .input-invalid from form-validation.css) */
.wizard-field-input.input-invalid,
.wizard-field-input.input-invalid:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.wizard-field-input.input-invalid:focus {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.wizard-field-error {
  font-size: var(--text-xs);
  color: var(--error, #ef4444);
  line-height: 1.4;
  margin: 0;
}

/* Validation Message in Wizard */
.wizard-field .validation-message {
  margin-top: var(--space-2);
}

/* Success State */
.wizard-field-input.has-success {
  border-color: var(--success, #10b981);
}

/* ============================================================================
   MONOSPACE INPUT — For license keys (distinguishes 0/O)
   ============================================================================ */

.wizard-field-input--mono {
  font-family: 'GeistMono', 'Consolas', 'Monaco', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================================
   BUTTON IN FIELD — Full height button next to input
   ============================================================================ */

.wizard-test-btn--full {
  width: 100%;
  height: var(--wizard-input-height);
}

/* ============================================================================
   WIZARD ACTIONS — Bottom Button Row
   ============================================================================ */

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--wizard-gap-group);
  padding-top: var(--wizard-gap-group);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Push right button to end when left button is hidden */
.wizard-actions--end {
  justify-content: flex-end;
}

/* ============================================================================
   WIZARD BUTTONS
   ============================================================================ */

.wizard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-family: inherit;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: 
    transform 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

/* Primary Button — Weiss mit dunkler Schrift */
.wizard-btn-primary {
  color: rgba(0, 50, 70, 1);
  background: rgba(255, 255, 255, 0.95);
  border: none;
  font-weight: var(--weight-semibold);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.1);
}

.wizard-btn-primary:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.wizard-btn-primary:active {
  transform: translateY(0);
}

.wizard-btn-primary:focus-visible {
  outline: none;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 0 0 2px rgba(255, 255, 255, 0.5),
    0 0 0 4px rgba(255, 255, 255, 0.25);
}

.wizard-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

/* Secondary Button — Border weiss, Text weiss */
.wizard-btn-secondary {
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.wizard-btn-secondary:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
}

.wizard-btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.wizard-btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Hidden button (for layout stability) */
.wizard-btn-hidden {
  visibility: hidden;
}

/* ============================================================================
   CONNECTION TEST BUTTON — Inline
   ============================================================================ */

.wizard-test-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: inherit;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 150ms ease;
}

.wizard-test-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.wizard-test-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Test result states */
.wizard-test-btn.is-loading {
  pointer-events: none;
}

.wizard-test-btn.is-success {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.3);
  background: rgba(255, 255, 255, 0.95);
}

.wizard-test-btn.is-error {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(255, 255, 255, 0.95);
}

/* Spinner for loading state */
.wizard-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: wizard-spin 600ms linear infinite;
}

@keyframes wizard-spin {
  to { transform: rotate(360deg); }
}

/* ============================================================================
   ALERT MESSAGES — White background with colored text + icons
   ============================================================================ */

.wizard-alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--wizard-gap-field);
  background: rgba(255, 255, 255, 0.95);
}

.wizard-alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.wizard-alert-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
}

/* Error Alert — Red text on white */
.wizard-alert-error {
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.wizard-alert-error .wizard-alert-icon svg {
  stroke: #ef4444;
}

/* Success Alert — Green text on white */
.wizard-alert-success {
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.wizard-alert-success .wizard-alert-icon svg {
  stroke: #059669;
}

/* Info Alert — Blue text on white */
.wizard-alert-info {
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 640px) {
  .wizard-shell {
    padding: var(--space-6);
  }
  
  .wizard-header-title {
    font-size: var(--text-2xl);
  }
  
  .wizard-lang-toggle {
    top: var(--space-4);
    right: var(--space-4);
  }
  
  .wizard-actions {
    flex-direction: column-reverse;
    gap: var(--space-3);
  }
  
  .wizard-btn {
    width: 100%;
  }
  
  .wizard-btn-hidden {
    display: none;
  }
}

/* ============================================================================
   STEP-SPECIFIC TWEAKS
   ============================================================================ */

/* Group separator between credential blocks */
.wizard-group-gap {
  margin-top: var(--space-2);
}

/* Test connection row */
.wizard-test-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.wizard-test-result {
  display: none;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
}

.wizard-test-result.is-success,
.wizard-test-result.is-error {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.wizard-test-result.is-success {
  color: #059669;
}

.wizard-test-result.is-error {
  color: #ef4444;
}

/* ============================================================================
   LOGIN PAGE VARIANT — Narrower Shell
   ============================================================================ */

.wizard-shell--narrow {
  width: min(420px, 94vw);
}

.wizard-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-6);
}

/* Auth Links (Forgot Password etc.) */
.wizard-auth-links {
  margin-top: var(--wizard-gap-field);
  text-align: center;
}

.wizard-auth-link {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  transition: color 200ms ease;
}

.wizard-auth-link:hover {
  color: rgba(0, 50, 70, 0.9);
}

/* Centered Actions (for Login etc.) */
.wizard-actions--center {
  margin-top: var(--wizard-gap-group);
  justify-content: center;
}

/* Auth Card Variant — For Login/Reset pages using standalone-card */
.standalone-card--auth {
  position: relative;
}

.standalone-card--auth .wizard-lang-toggle {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

.standalone-card--auth .wizard-field {
  margin-bottom: var(--wizard-gap-field);
}

.standalone-card--auth .wizard-actions--login {
  margin-top: var(--wizard-gap-group);
}
