/* =========================================================
   BirdPI – Setup Wizard
   Nutzt globale Variablen aus birdpi.css
   ========================================================= */

/* --- Layout --- */
.page-setup .wrap {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--pad);
  min-height: 100vh;
  min-height: 100dvh;
}

.setup-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* --- Progress Bar --- */
.setup-progress {
  padding: 16px 0 8px;
  flex-shrink: 0;
}

.progress-track {
  height: 4px;
  background: var(--grid);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width .4s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
  transition: color .2s;
}

.progress-step.active,
.progress-step.done {
  color: var(--fg);
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grid);
  transition: background .3s, transform .3s;
}

.progress-step.active .step-dot {
  background: var(--accent);
  transform: scale(1.3);
}

.progress-step.done .step-dot {
  background: var(--ok);
}

.step-label {
  font-size: 11px;
  white-space: nowrap;
}

/* --- Steps --- */
.setup-step {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.setup-step.active {
  display: flex;
}

.step-content {
  width: 100%;
}

.step-content.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 0;
}

.step-content h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
}

.step-content h2 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}

.setup-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 440px;
  margin: 0 auto 24px;
}

.setup-logo {
  width: 180px;
  height: auto;
  margin-bottom: 16px;
  opacity: .9;
}

.step-hint {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 16px;
}

/* --- Checklist (Welcome) --- */
.setup-checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  text-align: left;
  max-width: 420px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.checklist-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Primary CTA Button --- */
.btn-setup-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 36px;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}

.btn-setup-primary:hover {
  filter: brightness(1.1);
}

.btn-setup-primary:active {
  transform: scale(.97);
}

/* --- Navigation --- */
.setup-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 20px;
  flex-shrink: 0;
  gap: 8px;
}

.setup-nav .btn {
  min-width: 100px;
}

.setup-back-link {
  display: none;
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.7;
}

.setup-back-link.visible {
  display: inline-block;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--fg);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color .2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: var(--muted);
  opacity: .7;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-help {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.step-message {
  font-size: 0.85rem;
  min-height: 1.4em;
  margin: 8px 0;
}

.step-message.error { color: var(--high); }
.step-message.success { color: var(--ok); }

/* --- Info Banner --- */
.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(74, 222, 128, .1);
  border: 1px solid rgba(74, 222, 128, .25);
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  color: var(--fg);
}

.info-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ok);
  color: #000;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- WiFi Step --- */
.wifi-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.wifi-status-icon::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.wifi-status-icon.connected::before {
  background: var(--ok);
}

.wifi-status-icon.disconnected::before {
  background: var(--high);
}

.wifi-list {
  margin-top: 8px;
}

.wifi-list .wifi-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--grid);
}

.wifi-row .wifi-ssid {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wifi-row .wifi-sig {
  width: 50px;
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
}

.wifi-row.connected {
  font-weight: 600;
  color: var(--ok);
}

.setup-actions-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

/* --- WiFi PSK Modal --- */
.setup-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-modal-content {
  background: var(--card);
  padding: 20px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--sh);
  width: min(460px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-modal-content input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.95rem;
  box-sizing: border-box;
}

.setup-modal-content input:focus {
  outline: none;
  border-color: var(--accent);
}

.setup-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Mic Test Step --- */
.mic-test-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.mic-visual {
  position: relative;
  width: 120px;
  height: 120px;
}

.mic-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--grid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .3s, background .3s;
  position: relative;
  z-index: 1;
}

.mic-circle.recording {
  border-color: var(--high);
  animation: mic-pulse 1s ease-in-out infinite;
}

.mic-circle.ok {
  border-color: var(--ok);
}

.mic-icon::before {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  background: var(--muted);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z'/%3E%3Cpath d='M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z'/%3E%3Cpath d='M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.mic-circle.recording .mic-icon::before {
  background: var(--high);
}

.mic-circle.ok .mic-icon::before {
  background: var(--ok);
}

.mic-status-text {
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.mic-circle.fail {
  border-color: var(--high);
}

.mic-circle.fail .mic-icon::before {
  background: var(--high);
}

/* --- Level Meter --- */
.mic-level-meter {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 80px;
  width: 100%;
  max-width: 280px;
  padding: 0 8px;
}

.mic-level-bar {
  flex: 1;
  height: 4px;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--grid);
  transition: height .4s ease, background .3s;
}

.mic-level-bar.bar-high {
  background: var(--ok);
}

.mic-level-bar.bar-ok {
  background: var(--accent);
}

.mic-level-bar.bar-warn {
  background: var(--mid);
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .4); }
  50% { box-shadow: 0 0 0 16px rgba(248, 113, 113, 0); }
}

/* --- Finish Step --- */
.finish-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--ok);
  color: #000;
  font-size: 2.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.finish-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 28px;
  text-align: left;
  max-width: 360px;
  width: 100%;
}

.finish-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--grid);
  font-size: 0.9rem;
}

.finish-row .finish-label {
  color: var(--muted);
}

.finish-row .finish-value {
  font-weight: 600;
}

.finish-row .finish-value.ok { color: var(--ok); }
.finish-row .finish-value.warn { color: var(--mid); }

/* --- Responsive --- */
@media (max-width: 600px) {
  .step-label { font-size: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .setup-logo { width: 140px; }
  .step-content h1 { font-size: 1.3rem; }
  .checklist-item { font-size: 0.85rem; }
}
