/* Nuvemshop Office Access — Registration Page */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600&display=swap');

/* ============================================================
   Turnstile Gate Overlay
   ============================================================ */
.turnstile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.5s ease;
}

.turnstile-overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.turnstile-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.turnstile-card__logo {
  width: 56px;
  height: 56px;
}

.turnstile-card__widget {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.turnstile-card__status {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.turnstile-card__status--success {
  color: #16a34a;
}

/* ============================================================
   Success Screen — after successful submission
   ============================================================ */
.success-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
  animation: fadeInUp 0.5s ease;
}

.success-screen[hidden] {
  display: none !important;
}

.success-screen.success-screen--visible {
  display: flex;
}

.success-screen__card {
  background: var(--nube-surface, #ffffff);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.success-screen__icon {
  animation: scaleIn 0.4s ease 0.2s both;
}

.success-screen__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--nube-dark, #0f172a);
  margin: 0;
}

.success-screen__text {
  font-size: 15px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

.success-screen__info {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px 24px;
  width: 100%;
  text-align: left;
}

.success-screen__info-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.success-screen__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.success-screen__steps li {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  padding-left: 20px;
  position: relative;
}

.success-screen__steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0050c3;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --nube-blue: #0050c3;
  --nube-blue-hover: #00298f;
  --nube-dark: #171E43;
  --nube-light-blue: #DEEFFE;
  --nube-bg: #f5faff;
  --nube-surface: #ffffff;
  --nube-text: #343537;
  --nube-text-secondary: #A0A3A6;
  --nube-text-muted: #8A8D90;
  --nube-border: #E7E8E9;
  --nube-border-focus: #4b5fA0;
  --nube-error: #dc2626;
  --nube-radius: 16px;
  --nube-radius-sm: 6px;
  --nube-radius-pill: 100px;
  --nube-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --nube-transition: all ease-in-out 0.15s;
  --nube-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', arial, sans-serif;
}

html {
  font-family: var(--nube-font);
  font-size: 16px;
  line-height: 1.3;
  color: var(--nube-text);
  background: var(--nube-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--nube-surface);
  border-bottom: 1px solid var(--nube-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__logo {
  width: 32px;
  height: 32px;
}

.header__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--nube-blue);
}

.header__lang {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.header__lang-btn {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--nube-font);
  border: 1px solid var(--nube-border);
  border-radius: var(--nube-radius-pill);
  background: transparent;
  color: var(--nube-text-secondary);
  cursor: pointer;
  transition: var(--nube-transition);
}

.header__lang-btn--active,
.header__lang-btn:hover {
  background: var(--nube-blue);
  color: white;
  border-color: var(--nube-blue);
}

/* Layout */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page__heading {
  font-size: 24px;
  font-weight: 600;
  color: var(--nube-dark);
  margin-bottom: 4px;
}

.page__subtitle {
  font-size: 14px;
  color: var(--nube-text-secondary);
  margin-bottom: 32px;
}

/* Two-column grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .page {
    padding: 24px 16px 48px;
  }

  /* Mobile step flow */
  .form-section--hidden {
    display: none;
  }

  .form-footer--hidden {
    display: none;
  }

  /* Form footer sticky on mobile so submit is always visible */
  .form-footer {
    position: sticky;
    bottom: 0;
    background: var(--nube-surface);
    padding: 16px;
    margin: 0 -16px;
    border-top: 1px solid var(--nube-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 50;
  }

  .camera-section--fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    z-index: 100;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    background: #000;
  }

  /* Hide the header text in fullscreen — back button becomes overlay */
  .camera-section--fullscreen .camera-section__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    border-bottom: none;
    padding: 12px 16px;
  }

  .camera-section--fullscreen .camera-section__title {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
  }

  .camera-section--fullscreen .btn--back {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    padding: 8px 14px;
    font-size: 14px;
    min-height: 40px;
  }

  .camera-section--fullscreen .camera__stage {
    flex: 1;
    aspect-ratio: auto;
    max-height: none;
  }

  /* On mobile, hide SVG oval and use CSS oval that adapts to screen size */
  .camera-section--fullscreen .camera__overlay {
    display: none;
  }

  .camera-section--fullscreen .camera__stage::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(
      ellipse 55% 40% at 50% 45%,
      transparent 0%,
      transparent 100%,
      rgba(0, 0, 0, 0.55) 100%
    );
    /* Oval cutout using mask */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Crect width='100' height='100' fill='white'/%3E%3Cellipse cx='50' cy='45' rx='28' ry='36' fill='black'/%3E%3C/svg%3E");
    mask-size: 100% 100%;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Crect width='100' height='100' fill='white'/%3E%3Cellipse cx='50' cy='45' rx='28' ry='36' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-size: 100% 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }

  .camera-section--fullscreen .camera__status {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    z-index: 10;
    padding: 0 24px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  .camera-section--fullscreen .camera__actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: none;
  }

  .camera-section--fullscreen #btn-submit {
    width: 100%;
    margin-top: 8px;
  }
}

/* Form footer */
.form-footer {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sections */
.form-section {
  background: var(--nube-surface);
  border: 1px solid var(--nube-border);
  border-radius: var(--nube-radius);
  padding: 24px;
  box-shadow: var(--nube-shadow);
  display: flex;
  flex-direction: column;
}

.camera-section {
  background: var(--nube-surface);
  border: 1px solid var(--nube-border);
  border-radius: var(--nube-radius);
  overflow: hidden;
  box-shadow: var(--nube-shadow);
  display: flex;
  flex-direction: column;
}

.form-section__title,
.camera-section__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--nube-text-muted);
  margin-bottom: 16px;
}

/* Fields */
.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--nube-dark);
  margin-bottom: 6px;
}

.field__required {
  color: var(--nube-blue);
}

.field__input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--nube-font);
  border: 1px solid var(--nube-border);
  border-radius: var(--nube-radius-sm);
  background: var(--nube-surface);
  color: var(--nube-text);
  transition: var(--nube-transition);
  outline: none;
}

.field__input:focus {
  border-color: var(--nube-border-focus);
  box-shadow: 0 0 0 3px rgba(0, 80, 195, 0.08);
}

.field__input::placeholder {
  color: var(--nube-text-muted);
}

.field__input--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8D90' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field__help {
  display: block;
  font-size: 12px;
  color: var(--nube-text-muted);
  margin-top: 4px;
}

.field__help--success {
  color: var(--nube-success, #16a34a);
}

.field--warning {
  margin-top: 8px;
}

.warning-card {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
}

.warning-card__title {
  font-weight: 600;
  font-size: 14px;
  color: #92400e;
  margin: 0 0 8px 0;
}

.warning-card__text {
  font-size: 13px;
  color: #78350f;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.btn--warning {
  background: #f59e0b;
  color: #fff;
  border: none;
  font-weight: 500;
}

.btn--warning:hover {
  background: #d97706;
}

.field__input--validated {
  background: var(--nube-success-light, #f0fdf4);
  border-color: var(--nube-success, #16a34a);
  color: var(--nube-text-primary);
  font-weight: 500;
  cursor: default;
}

.field__error {
  font-size: 12px;
  color: var(--nube-error);
  margin-top: 4px;
}

/* Camera */
.camera-section__header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--nube-border);
}

.camera__stage {
  position: relative;
  aspect-ratio: 4/3;
  background: #171E43;
  overflow: hidden;
  flex: 1;
}

.camera__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Face guide overlay states — changes ellipse stroke color */
.camera__overlay--ready ellipse[stroke] {
  stroke: #22c55e;
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.camera__overlay--warning ellipse[stroke] {
  stroke: #eab308;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.camera__overlay--error ellipse[stroke] {
  stroke: #ef4444;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.camera__overlay-guide {
  stroke: rgba(255, 255, 255, 0.7);
}

.camera__preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera__canvas {
  display: none;
}

.camera__status {
  padding: 10px 24px;
  font-size: 13px;
  color: var(--nube-text-secondary);
  text-align: center;
  background: var(--nube-bg);
}

.camera__error {
  padding: 10px 24px;
  font-size: 13px;
  color: var(--nube-error);
  text-align: center;
  background: #fef2f2;
}

.camera__actions {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  justify-content: center;
}

/* Crop */
.crop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  cursor: move;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.crop-overlay--active {
  display: block;
}

.crop-frame {
  position: absolute;
  border: 2px solid var(--nube-blue);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-instructions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: white;
  background: rgba(0,0,0,0.6);
  padding: 4px 12px;
  border-radius: var(--nube-radius-pill);
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--nube-font);
  border: 1px solid transparent;
  border-radius: var(--nube-radius-pill);
  cursor: pointer;
  transition: var(--nube-transition);
  outline: none;
  white-space: nowrap;
}

.btn[hidden] {
  display: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--nube-blue);
  color: white;
}

.btn--primary:hover {
  background: var(--nube-blue-hover);
}

.btn--primary:disabled {
  background: #d5d7d9;
  color: #494b4d;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  background: transparent;
  color: var(--nube-blue);
  border-color: var(--nube-blue);
}

.btn--secondary:hover {
  background: var(--nube-blue);
  color: white;
}

.btn--submit {
  padding: 14px 48px;
  font-size: 16px;
}

/* Status */
.form-status {
  text-align: center;
  font-size: 14px;
  color: var(--nube-text-secondary);
  margin-top: 12px;
  min-height: 20px;
}

.form-status--success {
  color: #0ca76b;
}

.form-status--error {
  color: var(--nube-error);
}

/* Camera locked state (before document validation) */
.camera-section--locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.camera-section--locked::after {
  content: '🔒 Valide seu documento para liberar a câmera';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--nube-text-muted);
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--nube-radius);
  text-align: center;
  padding: 24px;
}

/* Full-width button inside form */
.btn--full {
  width: 100%;
  margin-top: 8px;
}

/* Back button */
.btn--back {
  background: var(--nube-light-blue);
  border: 1px solid var(--nube-blue);
  color: var(--nube-blue);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--nube-font);
  cursor: pointer;
  padding: 10px 16px;
  border-radius: var(--nube-radius-sm);
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
}

.btn--back:hover {
  background: var(--nube-blue);
  color: white;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px 16px;
  background: var(--nube-blue);
  color: white;
  z-index: 100;
  font-size: 13px;
  border-radius: 0 0 var(--nube-radius-sm) 0;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Noscript */
.noscript-warning {
  text-align: center;
  padding: 24px;
  color: var(--nube-error);
  font-size: 14px;
}

/* Visitor info (read-only pre-registration data) */
.visitor-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--nube-light-blue);
  border-radius: var(--nube-radius);
  margin-bottom: 24px;
}

.visitor-info__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visitor-info__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--nube-text-muted);
}

.visitor-info__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--nube-dark);
}

/* Token error state */
.token-error {
  text-align: center;
  padding: 48px 24px;
}

.token-error h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--nube-dark);
  margin-bottom: 8px;
}

.token-error p {
  font-size: 14px;
  color: var(--nube-text-secondary);
}
