/* ==========================================================================
   RESET & SETUP GERAL (PÁGINA FIXA SEM BARRA DE ROLAGEM)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Paleta Corporativa Inspired / Escolas */
  --color-primary-navy: #1b3d60;
  --color-primary-hover: #15314e;
  --color-accent-blue: #0e5b9e;
  --color-text-main: #1f3b5c;
  --color-text-muted: #536d88;
  --color-text-light: #8fa5ba;
  --color-border: #dbe7f2;
  --color-white: #ffffff;
  --color-google-gray: #3c4043;
  --font-family: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh; /* Garante viewport exata no Safari iOS e Chrome Android */
  overflow: hidden; /* Proíbe barra de rolagem */
  font-family: var(--font-family);
  background-color: #f7faff;
  color: var(--color-text-main);
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CONTAINER MASTER: FLEXBOX VERTICAL SEM SCROLL
   ========================================================================== */
.captive-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: linear-gradient(145deg, #f8fbff 0%, #edf4fc 45%, #e1eef9 100%);
  transition: background 0.4s ease;
}

/* ==========================================================================
   DESKTOP: CABEÇALHO COM LOGOS
   ========================================================================== */
.desktop-header {
  position: relative;
  z-index: 20;
  width: 100%;
  height: 76px;
  background-color: var(--color-primary-navy);
  box-shadow: 0 4px 14px rgba(10, 30, 50, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-content {
  max-width: 1200px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.desktop-logos-img {
  max-height: 48px;
  max-width: 90%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* ==========================================================================
   ILUSTRAÇÕES DE FUNDO (ONDAS WI-FI E MAPA PONTILHADO)
   ========================================================================== */
.wifi-waves-bg {
  position: absolute;
  top: 76px;
  right: 0;
  width: 360px;
  height: 360px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.8;
}

.wifi-waves-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.world-map-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0.35;
}

.world-map-bg .map-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom center;
}

/* ==========================================================================
   ÁREA CENTRAL (MAIN)
   ========================================================================== */
.main-container {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  width: 100%;
  max-height: calc(100dvh - 76px - 60px); /* Desktop */
}

/* ==========================================================================
   CARD DE AUTENTICAÇÃO (DESKTOP)
   ========================================================================== */
.auth-card {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(18, 52, 86, 0.08), 0 2px 6px rgba(18, 52, 86, 0.04);
  width: 100%;
  max-width: 520px;
  padding: clamp(26px, 4vh, 38px) clamp(24px, 3.5vw, 42px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.card-title {
  font-size: clamp(24px, 3.2vh, 28px);
  font-weight: 700;
  color: var(--color-primary-navy);
  letter-spacing: -0.5px;
  margin-bottom: clamp(12px, 1.8vh, 18px);
}

.card-text {
  font-size: clamp(13.5px, 1.8vh, 15px);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: clamp(18px, 2.8vh, 26px);
  max-width: 440px;
}

/* ==========================================================================
   FORMULÁRIO & CHECKBOX
   ========================================================================== */
.auth-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.terms-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: clamp(16px, 2.5vh, 22px);
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color var(--transition-fast);
}

.terms-label:hover {
  background-color: rgba(27, 61, 96, 0.04);
}

/* Checkbox customizado */
.custom-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-primary-navy);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.check-icon {
  width: 14px;
  height: 14px;
  color: var(--color-white);
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-fast);
}

.custom-checkbox:checked + .checkbox-box {
  background-color: var(--color-primary-navy);
  border-color: var(--color-primary-navy);
}

.custom-checkbox:checked + .checkbox-box .check-icon {
  opacity: 1;
  transform: scale(1);
}

.custom-checkbox:focus-visible + .checkbox-box {
  outline: 3px solid rgba(14, 91, 158, 0.35);
  outline-offset: 2px;
}

.terms-text {
  font-size: clamp(14px, 1.8vh, 15px);
  font-weight: 500;
  color: var(--color-primary-navy);
}

.terms-link {
  color: var(--color-accent-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.terms-link:hover {
  color: var(--color-primary-navy);
}

/* Mensagem de Validação (Shake) */
.validation-message {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #d93025;
  background-color: #fce8e6;
  border: 1px solid #fad2cf;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 14px;
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.validation-message.visible {
  display: flex;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ==========================================================================
   BOTÃO GOOGLE (AUTENTICAÇÃO)
   ========================================================================== */
.google-btn {
  width: 100%;
  height: clamp(48px, 6vh, 52px);
  background-color: var(--color-primary-navy);
  color: var(--color-white);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-family: var(--font-family);
  font-size: clamp(14.5px, 1.9vh, 15.5px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(27, 61, 96, 0.2);
  transition: all var(--transition-fast);
  outline: none;
}

.google-btn:not(:disabled):hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(27, 61, 96, 0.25);
}

.google-btn:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(27, 61, 96, 0.2);
}

/* Estado Desabilitado Desktop: Esmaecido e com cursor bloqueado */
.google-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: grayscale(30%);
}

.google-btn:disabled .google-icon-wrapper {
  opacity: 0.7;
}

.google-icon {
  width: 18px;
  height: 18px;
}

.google-btn-text {
  letter-spacing: -0.2px;
}

/* Estado Desabilitado (Visualmente sutil até aceitar) */
.google-btn.pending-acceptance {
  opacity: 0.92;
}

/* Estado de Carregamento */
.loading-state {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-primary-navy);
}

.loading-state.visible {
  display: flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(27, 61, 96, 0.2);
  border-top-color: var(--color-primary-navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   DESKTOP: RODAPÉ
   ========================================================================== */
.desktop-footer {
  position: relative;
  z-index: 20;
  width: 100%;
  height: 60px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.footer-left .network-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-light);
  letter-spacing: -0.2px;
}

.footer-right {
  display: flex;
  align-items: center;
}

.desktop-qr-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.desktop-qr-img:hover {
  transform: scale(1.05);
}

/* Utilitários de Visibilidade */
.mobile-only {
  display: none !important;
}

/* ==========================================================================
   ==========================================================================
   VERSÃO MOBILE (MAX-WIDTH: 768px)
   IDÊNTICA À QUARTA IMAGEM
   ==========================================================================
   ========================================================================== */
@media (max-width: 768px) {

  /* Oculta elementos exclusivos desktop */
  .desktop-only {
    display: none !important;
  }

  /* Exibe elementos mobile */
  .mobile-only {
    display: flex !important;
  }

  /* Fundo Degradê Azul Royal da Imagem 4 */
  .captive-wrapper {
    background: linear-gradient(172deg, #0e5b9e 0%, #0d4b85 40%, #08335d 100%);
    justify-content: space-between;
    padding: 0;
  }

  /* Mapa pontilhado no fundo mobile */
  .world-map-bg {
    opacity: 0.25;
    height: 40vh;
  }

  /* Container Principal Mobile: Flex vertical distribuído */
  .main-container {
    max-height: 100dvh;
    height: 100dvh;
    padding: clamp(14px, 2.5vh, 24px) 20px;
    justify-content: space-between;
  }

  /* Logos no Topo Mobile */
  .mobile-logos-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: clamp(6px, 1.5vh, 16px);
    flex-shrink: 0;
  }

  .mobile-logos-img {
    max-width: clamp(230px, 68vw, 310px);
    max-height: clamp(85px, 14vh, 120px);
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
  }

  /* Card Glassmorphism Mobile */
  .auth-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.24);
    border-radius: 24px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
    max-width: min(390px, 92vw);
    padding: clamp(20px, 3vh, 30px) clamp(18px, 4vw, 24px);
    color: var(--color-white);
    margin: auto 0; /* Centraliza verticalmente no espaço livre */
  }

  .card-title {
    color: var(--color-white);
    font-size: clamp(22px, 3vh, 26px);
    margin-bottom: clamp(10px, 1.8vh, 16px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  .card-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(12.5px, 1.7vh, 14px);
    line-height: 1.55;
    margin-bottom: clamp(16px, 2.4vh, 22px);
  }

  /* Checkbox Mobile */
  .terms-label {
    margin-bottom: clamp(16px, 2.4vh, 22px);
  }

  .terms-label:hover {
    background-color: rgba(255, 255, 255, 0.08);
  }

  .checkbox-box {
    border-color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.15);
  }

  .custom-checkbox:checked + .checkbox-box {
    background-color: var(--color-white);
    border-color: var(--color-white);
  }

  .custom-checkbox:checked + .checkbox-box .check-icon {
    color: var(--color-primary-navy);
  }

  .terms-text {
    color: var(--color-white);
    font-size: clamp(13px, 1.8vh, 14.5px);
  }

  .terms-link {
    color: #9fe2ff;
  }

  .terms-link:hover {
    color: var(--color-white);
  }

  /* Botão Google Mobile (Branco com texto azul / idêntico ao botão da foto 4) */
  .google-btn {
    background-color: var(--color-white);
    color: var(--color-primary-navy);
    border-radius: 50px; /* Borda 100% arredondada pill */
    font-size: clamp(14px, 1.9vh, 15px);
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    height: clamp(48px, 6vh, 52px);
  }

  .google-btn:not(:disabled):hover {
    background-color: #f5f9ff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  }

  /* Estado Desabilitado Mobile */
  .google-btn:disabled {
    opacity: 0.45;
    background-color: rgba(255, 255, 255, 0.65);
    color: rgba(27, 61, 96, 0.6);
    box-shadow: none;
    cursor: not-allowed;
  }

  .google-icon-wrapper {
    background-color: transparent;
    box-shadow: none;
    width: 22px;
    height: 22px;
  }

  .google-icon {
    width: 20px;
    height: 20px;
  }

  /* Loading State Mobile */
  .loading-state {
    color: var(--color-white);
  }

  .spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
  }

  /* Mensagem de validação Mobile */
  .validation-message {
    background-color: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 100, 100, 0.4);
    color: #ffcccc;
  }

  /* Rodapé Mobile Centralizado */
  .mobile-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: clamp(6px, 1.5vh, 14px);
  }

  .mobile-qr-img {
    height: clamp(52px, 8vh, 68px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  }

  .network-badge {
    font-size: clamp(11.5px, 1.5vh, 13px);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    letter-spacing: -0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* ==========================================================================
   MODAL DE TERMOS DE USO
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 25, 45, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--color-white);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  transform: scale(0.94) translateY(12px);
  transition: transform var(--transition-smooth);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary-navy);
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.close-modal-btn:hover {
  color: var(--color-primary-navy);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.modal-body li {
  margin-bottom: 6px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
}

.btn-agree {
  background-color: var(--color-primary-navy);
  color: var(--color-white);
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.btn-agree:hover {
  background-color: var(--color-primary-hover);
}

/* ==========================================================================
   TELA DE SUCESSO APÓS AUTENTICAÇÃO
   ========================================================================== */
.success-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 30, 50, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 20px;
}

.success-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.success-card {
  background: var(--color-white);
  border-radius: 24px;
  padding: 36px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-screen.active .success-card {
  transform: scale(1);
}

.success-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e6f4ea;
  color: #137333;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.success-icon-box svg {
  width: 36px;
  height: 36px;
}

.success-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary-navy);
  margin-bottom: 10px;
}

.success-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 22px;
}

.wifi-connected-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #e8f0fe;
  color: #1a73e8;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}

.dot-pulse {
  width: 8px;
  height: 8px;
  background-color: #34a853;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(52, 168, 83, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0); }
}
