/* =====================================================
   ElevatorGuard Pro — Sección Conexiones + Wizard
   ===================================================== */

/* ═══ CABECERA DE LA SECCIÓN ═══ */
.conexiones-header {
  margin-bottom: 20px;
}
.conexiones-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.conexiones-header h2 i { color: var(--accent); }
.conexiones-header p { font-size: 13px; color: var(--text-muted); }

/* ═══ CARDS ═══ */
.cx-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.cx-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card2);
}
.cx-card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cx-card-icon.blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cx-card-icon.green  { background: rgba(16,185,129,0.15); color: #10b981; }
.cx-card-icon.purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.cx-card-icon.orange { background: rgba(245,158,11,0.15); color: #f59e0b; }
.cx-card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.cx-card-header p { font-size: 12px; color: var(--text-muted); }
.cx-card-body { padding: 20px; }

/* ═══ ASISTENTE WIZARD ═══ */
.cx-wizard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Barra de progreso */
.cx-wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 20px;
  background: var(--bg-darkest);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.cx-wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cx-wizard-step span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.cx-wizard-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.cx-wizard-step.active .cx-wizard-num {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 20px rgba(59,130,246,0.5);
}
.cx-wizard-step.active span { color: #60a5fa; }
.cx-wizard-step.done .cx-wizard-num {
  background: rgba(16,185,129,0.2);
  border-color: #10b981;
  color: #10b981;
}
.cx-wizard-step.done span { color: #10b981; }
.cx-wizard-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
}

/* Paneles del wizard */
.cx-wizard-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}
.cx-wizard-panel.active { display: flex; }
.cx-wizard-panel h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.cx-wizard-panel > p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Selector de cabinas */
.cx-cabin-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.cx-pick-card {
  padding: 14px;
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.cx-pick-card:hover {
  border-color: #60a5fa;
  transform: translateY(-2px);
}
.cx-pick-card.selected {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
  box-shadow: 0 0 20px rgba(59,130,246,0.3);
}
.cx-pick-card.selected::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 8px;
  right: 8px;
  color: #10b981;
  font-size: 14px;
}
.cx-pick-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 6px;
}
.cx-pick-building {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Formulario de conexión */
.cx-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.cx-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cx-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cx-field label i { color: var(--accent); }
.cx-field input,
.cx-field select {
  background: var(--bg-darkest);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.cx-field input:focus,
.cx-field select:focus { border-color: var(--accent); }
.cx-field-value {
  background: var(--bg-darkest);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
}
.cx-field-value.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #f59e0b;
}

/* QR layout */
.cx-qr-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}
.cx-qr-box {
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cx-qr-box canvas {
  display: block;
  width: 200px;
  height: 200px;
}
.cx-qr-box small {
  font-size: 10px;
  color: #333;
  text-align: center;
  font-weight: 600;
}
.cx-qr-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cx-pair-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 4px;
  text-align: center;
  padding: 14px;
  background: var(--bg-darkest);
  border: 2px dashed rgba(245,158,11,0.4);
  border-radius: 10px;
}
.cx-download-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Caja URL copiable */
.cx-url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-darkest);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
}
.cx-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #60a5fa;
  flex: 1;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-url-box button {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  white-space: nowrap;
}
.cx-url-box button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Verificación */
.cx-verify-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cx-verify-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s;
}
.cx-verify-item.ok { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.05); }
.cx-verify-item.fail { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.05); }
.cx-verify-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cx-verify-dot.pending { background: #64748b; animation: blink-yellow 1s infinite; }
.cx-verify-dot.ok { background: #10b981; box-shadow: 0 0 10px #10b981; }
.cx-verify-dot.fail { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.cx-verify-item strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.cx-verify-item span {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Caja de éxito */
.cx-success-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.4);
  border-radius: 12px;
  animation: fadeIn 0.4s ease;
}
.cx-success-box i {
  font-size: 32px;
  color: #10b981;
}
.cx-success-box strong {
  display: block;
  font-size: 15px;
  color: #10b981;
  margin-bottom: 3px;
}
.cx-success-box span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Acciones del wizard */
.cx-wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.cx-wizard-actions .btn-secondary,
.cx-wizard-actions .btn-primary {
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.cx-wizard-actions .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cx-wizard-actions .btn-primary:disabled:hover { transform: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink-yellow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ═══ TABLA DE CABINAS REGISTRADAS ═══ */
.cx-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.cx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.cx-table thead {
  background: var(--bg-dark);
}
.cx-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cx-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cx-table tbody tr:hover { background: var(--bg-hover); }
.cx-token {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #f59e0b;
  background: var(--bg-darkest);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.cx-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  color: #60a5fa;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.15s;
}
.cx-copy-btn:hover {
  background: rgba(59,130,246,0.25);
  color: #93c5fd;
}

/* Responsive */
@media (max-width: 800px) {
  .cx-qr-layout { grid-template-columns: 1fr; }
  .cx-field-grid { grid-template-columns: 1fr; }
  .cx-wizard-progress { flex-wrap: wrap; }
  .cx-wizard-line { display: none; }
}