/**
 * auth-page.css — Connexion / inscription OkDak (expérience type Apple)
 * Requiert apple-tokens.css + style.css
 */

/* Base body + fond : apple-tokens.css (body.auth-app) */
body.auth-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

body.auth-app h1 {
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  margin-bottom: 0.75rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.08;
  background: none;
  -webkit-text-fill-color: unset;
  color: var(--apple-text);
  text-shadow: none;
}

body.auth-app .auth-header {
  text-align: center;
  margin-bottom: 2rem;
  max-width: 36rem;
}

body.auth-app .cta-text h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  background: none;
  -webkit-text-fill-color: unset;
  color: var(--apple-text);
}

body.auth-app .auth-lead,
body.auth-app .cta-text p {
  font-size: 1rem;
  color: var(--apple-text-secondary);
  margin-top: 0.75rem;
  line-height: 1.55;
}

/* Toolbar QR */
body.auth-app .auth-qr-toolbar {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

body.auth-app .auth-btn {
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: var(--apple-radius-control);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  transition: transform var(--apple-duration-fast) var(--apple-ease-out),
    box-shadow var(--apple-duration-fast) var(--apple-ease-out),
    filter var(--apple-duration-fast) var(--apple-ease-out);
}

body.auth-app .auth-btn--primary {
  background: var(--apple-blue-deep);
  color: #fff;
  border-radius: var(--apple-radius-pill);
  box-shadow: var(--apple-shadow-hairline), 0 4px 18px rgba(0, 113, 227, 0.42);
}

body.auth-app .auth-btn--primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: var(--apple-shadow-hairline), 0 8px 28px rgba(0, 113, 227, 0.48);
}

body.auth-app .auth-btn--success {
  background: #30d158;
  color: #0d1117;
  box-shadow: 0 4px 14px rgba(48, 209, 88, 0.3);
}

body.auth-app .auth-btn--success:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

body.auth-app .auth-btn--secondary {
  background: var(--apple-fill);
  color: var(--apple-text);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-sm);
}

body.auth-app .auth-btn--secondary:hover {
  background: var(--apple-fill-secondary);
}

body.auth-app .auth-btn--danger {
  background: #ff453a;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 69, 58, 0.35);
}

body.auth-app .auth-btn--danger:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

body.auth-app .auth-qr-panel {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.35rem;
  background: rgba(28, 28, 30, 0.72);
  border-radius: var(--apple-radius-card);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-card);
  animation: authSlideInDown 0.45s var(--apple-ease-out);
}

body.auth-app .auth-qr-panel-title {
  color: var(--apple-blue);
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.auth-app .auth-qr-panel-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

body.auth-app .auth-qr-panel-actions--mt {
  margin-top: 1rem;
}

body.auth-app #qrcode {
  margin: auto;
  padding: 0.75rem;
  background: #fff;
  border-radius: 12px;
  display: inline-block;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

body.auth-app #qr-status,
body.auth-app #scan-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--apple-text-secondary);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
}

body.auth-app #qr-reader {
  width: 300px;
  margin: auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--apple-border-strong);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

body.auth-app #qr-reader video {
  border-radius: 10px;
}

body.auth-app #qr-countdown {
  font-weight: 600;
  font-size: 1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: var(--apple-glass);
  border: 1px solid var(--apple-border);
}

/* Formulaire */
body.auth-app .form-wrapper {
  perspective: 1000px;
  width: 100%;
  max-width: 420px;
  animation: authFadeInUp 0.7s var(--apple-ease-out);
  margin-bottom: 2rem;
}

body.auth-app .form-flip {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1000px;
  margin-bottom: 1rem;
  min-height: 26rem;
}

body.auth-app .form-flip.flipped {
  min-height: 58rem;
}

@media (max-width: 480px) {
  body.auth-app .form-flip.flipped {
    min-height: 64rem;
  }
}

body.auth-app .form-inner {
  width: 100%;
  height: auto;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s var(--apple-ease-out);
}

body.auth-app .form-flip.flipped .form-inner {
  transform: rotateY(180deg);
}

body.auth-app .form-face {
  position: absolute;
  width: 100%;
  backface-visibility: hidden;
  background: rgba(28, 28, 30, 0.92);
  border: 1px solid var(--apple-border-strong);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding: 1.35rem;
  border-radius: var(--apple-radius-card);
  box-shadow: var(--apple-shadow-float);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  justify-content: flex-start;
  top: 0;
  left: 0;
  height: auto;
  min-height: 320px;
  max-height: none;
  overflow-y: auto;
  transition: box-shadow var(--apple-duration-fast) var(--apple-ease);
  z-index: 1;
  animation: authSlideIn 0.5s var(--apple-ease-out);
}

body.auth-app .form-flip.flipping .form-face {
  box-shadow: var(--apple-shadow-float), 0 0 0 1px rgba(41, 151, 255, 0.14);
}

body.auth-app .form-face.front {
  z-index: 2;
  transform: rotateY(0deg);
}

body.auth-app .form-face.back {
  transform: rotateY(180deg);
  animation: authSlideInBack 0.5s var(--apple-ease-out);
}

body.auth-app .form-face h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--apple-text);
  margin: 0 0 0.25rem;
}

body.auth-app .form-face input,
body.auth-app .form-face textarea {
  padding: 0.65rem 0.75rem;
  font-size: 0.9375rem;
  border-radius: var(--apple-radius-control);
  border: 1px solid var(--apple-border);
  width: 100%;
  background: var(--apple-fill-tertiary);
  color: var(--apple-text);
  letter-spacing: -0.01em;
  box-shadow: var(--apple-shadow-sm);
}

body.auth-app .form-face input::placeholder,
body.auth-app .form-face textarea::placeholder {
  color: var(--apple-text-tertiary);
}

body.auth-app .form-face input:focus,
body.auth-app .form-face textarea:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: var(--apple-focus-ring);
}

body.auth-app .form-face button[type="submit"],
body.auth-app .form-face button[onclick="login()"] {
  width: 100%;
  background: var(--apple-blue-deep);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  border: none;
  border-radius: var(--apple-radius-pill);
  padding: 0.7rem 1rem;
  min-height: 44px;
  transition: filter var(--apple-duration-fast) var(--apple-ease-out), transform var(--apple-duration-fast) var(--apple-ease-out);
  box-shadow: var(--apple-shadow-hairline), 0 4px 18px rgba(0, 113, 227, 0.42);
}

body.auth-app .form-face button[type="submit"]:hover,
body.auth-app .form-face button[onclick="login()"]:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

body.auth-app .form-face button[onclick="signInWithGoogle()"] {
  width: 100%;
  background: var(--apple-fill);
  color: var(--apple-text);
  border: 1px solid var(--apple-border);
  border-radius: var(--apple-radius-pill);
  box-shadow: var(--apple-shadow-sm);
}

body.auth-app .form-face button[onclick="signInWithGoogle()"]:hover {
  background: var(--apple-fill-secondary);
  filter: none;
}

body.auth-app .form-face p a {
  color: var(--apple-blue);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--apple-duration-fast) var(--apple-ease);
}

body.auth-app .form-face p a:hover {
  opacity: 0.85;
  text-decoration: underline;
}

body.auth-app .form-group {
  margin-bottom: 0.65rem;
}

body.auth-app .form-group label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--apple-text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
}

body.auth-app .form-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--apple-text-tertiary);
  margin-top: 0.25rem;
}

body.auth-app input[type="file"] {
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--apple-border-strong);
  border-radius: 12px;
  cursor: pointer;
  color: var(--apple-text-secondary);
}

body.auth-app input[type="file"]::-webkit-file-upload-button {
  background: var(--apple-blue-deep);
  color: #fff;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 0.75rem;
  font-weight: 500;
}

body.auth-app .auth-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
  gap: 2px;
  padding: 3px;
  background: var(--apple-fill-tertiary);
  border-radius: var(--apple-radius-pill);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-sm);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

body.auth-app .auth-tabs .tab {
  flex: 1;
  background: transparent;
  color: var(--apple-text-secondary);
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--apple-radius-pill);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background var(--apple-duration-fast) var(--apple-ease), color var(--apple-duration-fast) var(--apple-ease);
}

body.auth-app .auth-tabs .tab.active,
body.auth-app .auth-tabs .tab:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--apple-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.auth-app .input-group {
  display: flex;
  align-items: center;
  background: var(--apple-fill-tertiary);
  border-radius: var(--apple-radius-control);
  margin-bottom: 0.65rem;
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-sm);
  transition: border-color var(--apple-duration-fast) var(--apple-ease);
}

body.auth-app .input-group:focus-within {
  border-color: var(--apple-blue);
  box-shadow: var(--apple-focus-ring);
}

body.auth-app .input-group input,
body.auth-app .input-group textarea {
  background: transparent;
  border: none;
  box-shadow: none;
}

body.auth-app .input-group input:focus,
body.auth-app .input-group textarea:focus {
  box-shadow: none;
}

body.auth-app .input-icon {
  font-size: 1.1em;
  margin-right: 0.5em;
  opacity: 0.85;
}

body.auth-app .toggle-pwd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--apple-fill);
  border: none;
  color: var(--apple-text-secondary);
  cursor: pointer;
  font-size: 0.95em;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transition: background var(--apple-duration-fast) var(--apple-ease);
}

body.auth-app .toggle-pwd:hover {
  background: var(--apple-fill-secondary);
  color: var(--apple-text);
  transform: translateY(-50%) scale(1.05);
}

body.auth-app .status-zone {
  margin: 1rem auto 0;
  max-width: 420px;
  background: var(--apple-fill-tertiary);
  border-radius: var(--apple-radius-control);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-sm);
  padding: 1rem;
  text-align: center;
  min-height: 3rem;
  position: relative;
  z-index: 2;
}

body.auth-app .banner-message {
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  background: rgba(41, 151, 255, 0.15);
  color: var(--apple-text);
  border: 1px solid rgba(41, 151, 255, 0.25);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: center;
  position: relative;
  z-index: 3;
}

body.auth-app .banner-message[style*="background: #ffb3b3"] {
  background: rgba(255, 69, 58, 0.2) !important;
  color: #ff9a94 !important;
  border-color: rgba(255, 69, 58, 0.35);
}

body.auth-app .banner-message[style*="background: #b3ffb3"] {
  background: rgba(48, 209, 88, 0.15) !important;
  color: #5de37d !important;
  border-color: rgba(48, 209, 88, 0.3);
}

body.auth-app .loading-indicator {
  color: var(--apple-blue);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  position: relative;
  z-index: 3;
}

body.auth-app .form-face,
body.auth-app .form-inner {
  min-height: unset !important;
  max-height: unset !important;
  height: auto !important;
  overflow: visible !important;
}

/* Avantages */
body.auth-app .benefits {
  margin: 3rem auto;
  text-align: center;
  animation: authFadeInUp 0.8s var(--apple-ease-out) 0.1s both;
  max-width: 56rem;
  padding: 1.25rem;
  border-radius: var(--apple-radius-card);
  background: rgba(28, 28, 30, 0.72);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-card);
}

body.auth-app .benefits h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin-bottom: 1.25rem;
  color: var(--apple-text);
  font-weight: 600;
  letter-spacing: -0.035em;
  background: none;
  -webkit-text-fill-color: unset;
}

body.auth-app .auth-benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  text-align: left;
}

body.auth-app .auth-benefit-card {
  background: var(--apple-fill-tertiary);
  padding: 1.25rem;
  border-radius: var(--apple-radius-control);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-sm);
  transition: border-color var(--apple-duration-fast) var(--apple-ease), box-shadow var(--apple-duration-fast) var(--apple-ease);
}

body.auth-app .auth-benefit-card:hover {
  border-color: var(--apple-border-strong);
  box-shadow: var(--apple-shadow-card);
}

body.auth-app .auth-benefit-card-title {
  color: var(--apple-text);
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.auth-app .auth-benefit-card p {
  color: var(--apple-text-secondary);
  line-height: 1.55;
  margin: 0;
  font-size: 0.9rem;
}

/* Témoignage / footer */
body.auth-app .testimonial {
  background: rgba(28, 28, 30, 0.72);
  padding: 2rem;
  margin: 3rem auto;
  border-left: 3px solid var(--apple-blue);
  max-width: 42rem;
  border-radius: var(--apple-radius-sheet);
  box-shadow: var(--apple-shadow-card);
  color: var(--apple-text-secondary);
  font-style: italic;
  animation: authFadeInUp 0.85s var(--apple-ease-out) 0.15s both;
  border-top: 1px solid var(--apple-border);
  border-right: 1px solid var(--apple-border);
  border-bottom: 1px solid var(--apple-border);
}

body.auth-app .testimonial blockquote {
  margin: 0;
  padding-left: 1rem;
  position: relative;
}

body.auth-app .testimonial blockquote::before {
  content: none;
}

body.auth-app .testimonial p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--apple-text);
}

body.auth-app .testimonial footer {
  margin-top: 1.25rem;
  font-style: normal;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--apple-text-secondary);
  text-align: right;
}

body.auth-app .bandeau-footer,
body.auth-app .footer-links {
  font-size: 0.875rem;
  color: var(--apple-text-tertiary);
}

body.auth-app .footer-links a,
body.auth-app .bandeau-footer a {
  color: var(--apple-blue);
  text-decoration: none;
}

body.auth-app .footer-links a:hover,
body.auth-app .bandeau-footer a:hover {
  text-decoration: underline;
}

body.auth-app .auth-tagline {
  text-align: center;
  margin-top: 2rem;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--apple-text-secondary);
  letter-spacing: -0.02em;
  text-shadow: none;
}

body.auth-app .auth-tagline strong {
  color: var(--apple-blue);
  font-style: normal;
  font-weight: 600;
}

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

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes authSlideInBack {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes authSlideInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  body.auth-app #qr-reader {
    width: min(280px, 92vw) !important;
  }

  body.auth-app #qrcode {
    transform: scale(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-app .form-inner {
    transition: none;
  }

  body.auth-app .form-face,
  body.auth-app .benefits,
  body.auth-app .form-wrapper,
  body.auth-app .testimonial,
  body.auth-app .auth-qr-panel {
    animation: none;
  }

  body.auth-app .auth-btn:hover,
  body.auth-app .form-face button:hover {
    transform: none;
  }
}
