/* Vehyly Check-in — estilo kiosco (tablet), safe-area en todo. */

:root {
  --ve-blue: #2979FF;
  --ve-blue-dark: #004E89;
  --ve-green: #00D9A5;
  --ve-bg: #F5F7FA;
  --ve-text: #10182B;
  --ve-muted: #64748B;
  --ve-danger: #EF4444;
  --ve-radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden; /* kiosco: sin scroll accidental de la pagina completa */
  background: var(--ve-bg);
  color: var(--ve-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none; /* evita seleccion de texto accidental en uso publico */
}

button, input {
  font-family: inherit;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Pantalla de emparejamiento ---------- */
.pairing-screen {
  background: linear-gradient(160deg, var(--ve-blue-dark), var(--ve-blue));
  color: #fff;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.pairing-card {
  max-width: 640px;
  width: 100%;
  padding: 40px;
  text-align: center;
}
.pairing-card h1 { font-size: 28px; margin: 8px 0 12px; }
.pairing-card p { font-size: 18px; opacity: 0.9; margin: 0 0 24px; }
.code-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 24px 0;
}
.code-display .code-char {
  width: 56px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 12px;
  letter-spacing: 1px;
}
.pairing-status { min-height: 24px; color: #ffd1d1; }

/* ---------- App de registro ---------- */
.checkin-screen {
  background: var(--ve-bg);
}
.app-header {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) 14px calc(18px + env(safe-area-inset-left));
}
.unlink-btn {
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--ve-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.app-main {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  padding: 0 calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
}

.brand-mark {
  font-size: 22px;
  font-weight: 800;
  color: var(--ve-blue);
  letter-spacing: -0.5px;
}
.brand-mark.small { font-size: 18px; }

/* ---------- Pasos (contenedor comun) ---------- */
.screen-step {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding-top: 56px; /* deja lugar al selector de idioma */
}
.screen-step h1 { font-size: 30px; margin: 0 0 8px; }
.screen-step p { font-size: 18px; color: var(--ve-muted); margin: 0 0 20px; }

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 6px;
  background: #fff;
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--ve-muted);
  font-weight: 700;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-btn.active {
  background: var(--ve-blue);
  color: #fff;
}

/* ---------- Botones ---------- */
.btn-primary, .btn-secondary {
  border: none;
  border-radius: 16px;
  font-weight: 800;
  font-size: 19px;
  padding: 18px 28px;
  cursor: pointer;
  min-width: 160px;
}
.btn-primary {
  background: var(--ve-blue);
  color: #fff;
}
.btn-primary:active { background: var(--ve-blue-dark); }
.btn-primary:disabled { opacity: 0.6; }
.btn-secondary {
  background: #E7ECF3;
  color: var(--ve-text);
}
.btn-huge {
  padding: 26px 48px;
  font-size: 24px;
  border-radius: 20px;
  margin-top: 12px;
}
.step-actions {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}
.step-actions .btn-primary,
.step-actions .btn-secondary {
  flex: 1 1 0;
  max-width: 280px;
}

/* ---------- Paso: bienvenida / cerrado ---------- */
.step-welcome .brand-mark { font-size: 40px; margin-bottom: 8px; }
.step-closed .closed-icon,
.step-confirm .confirm-icon { font-size: 56px; margin-bottom: 8px; }
.step-closed h1 { color: var(--ve-danger); }

/* ---------- Paso: formulario ---------- */
.step-form { align-items: stretch; text-align: left; }
.step-form h1 { text-align: center; }
.field-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--ve-muted);
  margin: 14px 2px 6px;
}
.field-input {
  width: 100%;
  font-size: 22px;
  padding: 18px 16px;
  border-radius: 14px;
  border: 2px solid #E2E8F0;
  background: #fff;
  outline: none;
}
.field-input:focus { border-color: var(--ve-blue); }
.field-error {
  color: var(--ve-danger);
  font-size: 14px;
  min-height: 18px;
  margin: 4px 2px 0;
}

/* ---------- Paso: barbero ---------- */
.barber-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 4px 2px 12px;
  flex: 1 1 auto;
}
.barber-option {
  background: #fff;
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.barber-option.selected {
  border-color: var(--ve-blue);
  background: #EAF2FF;
}
.barber-avatar { font-size: 30px; }
.barber-name { font-weight: 700; font-size: 16px; }
.barber-chair { font-size: 13px; color: var(--ve-muted); }

/* ---------- Paso: confirmacion ---------- */
.confirm-position {
  font-size: 22px;
  font-weight: 800;
  color: var(--ve-blue-dark);
  background: #EAF2FF;
  border-radius: 14px;
  padding: 14px 22px;
  margin-bottom: 16px;
}
.step-confirm .confirm-icon { color: var(--ve-green); }

/* ---------- Toast de error ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ve-text);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 16px;
  max-width: 80vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive: tablets angostas / portrait ---------- */
@media (max-width: 480px) {
  .screen-step h1 { font-size: 24px; }
  .btn-huge { padding: 20px 32px; font-size: 20px; }
  .code-display .code-char { width: 42px; height: 54px; font-size: 26px; }
}
