/* Rafetus auth web — mirrors lib/custom_code/widgets/onboarding/widget_auth_gate.dart */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@500;600;700;900&family=Inter:wght@500;600;700;900&display=swap');

/* LightModeTheme */
html[data-theme='light'] {
  --primary: #bf2c20;
  --primary-end: #c0392b;
  --primary-bg: #e8dac0;
  --title: rgba(0, 0, 0, 0.87);
  --sub: rgba(0, 0, 0, 0.54);
  --hint: rgba(0, 0, 0, 0.38);
  --card-bg: rgba(255, 255, 255, 0.76);
  --card-border: rgba(255, 255, 255, 0.42);
  --card-shadow: rgba(0, 0, 0, 0.18);
  --field-bg: rgba(0, 0, 0, 0.035);
  --field-border: rgba(0, 0, 0, 0.06);
  --chip-bg: rgba(0, 0, 0, 0.05);
  --chip-border: rgba(0, 0, 0, 0.12);
  --social-bg: rgba(255, 255, 255, 0.72);
  --social-border: rgba(0, 0, 0, 0.08);
  --blob-a: rgba(191, 44, 32, 0.32);
  --blob-b: rgba(191, 44, 32, 0.14);
  --link-muted: rgba(0, 0, 0, 0.54);
  --err: #d63b3b;
  --ok: #2a9467;
}

/* DarkModeTheme */
html[data-theme='dark'] {
  --primary: #bf2c20;
  --primary-end: #c0392b;
  --primary-bg: #141416;
  --title: #ffffff;
  --sub: rgba(255, 255, 255, 0.7);
  --hint: rgba(255, 255, 255, 0.38);
  --card-bg: rgba(0, 0, 0, 0.66);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: rgba(0, 0, 0, 0.5);
  --field-bg: rgba(255, 255, 255, 0.06);
  --field-border: rgba(255, 255, 255, 0.1);
  --chip-bg: rgba(255, 255, 255, 0.1);
  --chip-border: rgba(255, 255, 255, 0.24);
  --social-bg: rgba(255, 255, 255, 0.08);
  --social-border: rgba(255, 255, 255, 0.15);
  --blob-a: rgba(191, 44, 32, 0.32);
  --blob-b: rgba(191, 44, 32, 0.14);
  --link-muted: rgba(255, 255, 255, 0.7);
  --err: #d63b3b;
  --ok: #2a9467;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.auth-page {
  font-family: 'Be Vietnam Pro', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--primary-bg);
  color: var(--title);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.auth-bg::before,
.auth-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.auth-bg::before {
  width: 500px;
  height: 500px;
  top: -110px;
  right: -100px;
  background: var(--blob-a);
  animation: blob-a 15s ease-in-out infinite alternate;
}

.auth-bg::after {
  width: 450px;
  height: 450px;
  bottom: -150px;
  left: -100px;
  background: var(--blob-b);
  animation: blob-b 20s ease-in-out infinite alternate;
}

@keyframes blob-a {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-90px, 140px);
  }
}

@keyframes blob-b {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(140px, -90px);
  }
}

.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
}

.auth-logo-wrap {
  display: block;
  width: 96px;
  height: calc(96px * 1.1);
  margin-bottom: 28px;
}

.auth-logo-svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--primary);
}

.auth-logo-stroke {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-network-backdrop {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(
    ellipse 130% 95% at 50% 40%,
    rgb(0 0 0 / 1) 0%,
    rgb(0 0 0 / 0.82) 58%,
    rgb(0 0 0 / 0.35) 82%,
    transparent 100%
  );
}

.auth-network-backdrop--dark {
  opacity: 0.92;
}

.auth-card-outer {
  width: 100%;
  max-width: 450px;
  border-radius: 32px;
  box-shadow: 0 15px 40px var(--card-shadow);
}

.auth-card {
  padding: 24px;
  border-radius: 32px;
  background: var(--card-bg);
  border: 1.2px solid var(--card-border);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--title);
  line-height: 1.2;
}

.auth-title-sm {
  font-size: 24px;
}

.auth-sub {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  line-height: 1.45;
}

.auth-sub.section {
  margin-bottom: 32px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 0 12px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--title);
  cursor: pointer;
  border-radius: 12px;
}

.auth-back:hover {
  background: var(--field-bg);
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field-wrap {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-radius: 16px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  overflow: hidden;
}

.auth-field-icon {
  flex-shrink: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 18px;
}

.auth-field-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--title);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 12px 14px 0;
  outline: none;
}

.auth-field-wrap input::placeholder {
  color: var(--hint);
  font-weight: 500;
}

.auth-field-toggle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 8px;
  gap: 8px;
}

.auth-link-row button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--link-muted);
}

.auth-link-row button.link-primary {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  height: 54px;
  margin-top: 4px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 6px 12px color-mix(in srgb, var(--primary) 28%, transparent);
}

.btn-primary:disabled:not(.is-loading) {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary.is-loading {
  position: relative;
  color: transparent !important;
  cursor: wait;
  pointer-events: none;
  opacity: 1;
}

.btn-primary.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
}

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

.auth-switch {
  margin: 20px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.5;
}

.auth-switch button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
  font-size: 13px;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 20px;
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--sub) 12%, transparent);
}

.auth-or span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--sub);
}

.auth-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 4px;
}

.auth-social-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.2px solid var(--social-border);
  background: var(--social-bg);
  color: var(--title);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.15s ease;
}

.auth-social-btn:hover {
  transform: scale(1.04);
}

.auth-social-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-chips {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  max-width: 450px;
  width: 100%;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--title);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.auth-chip .chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25em;
  font-size: 18px;
  line-height: 1;
}

#cf-turnstile,
#cf-turnstile-signup,
#cf-turnstile-forgot {
  display: flex;
  justify-content: center;
  min-height: 70px;
  margin: 8px 0;
}

.ts-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  min-height: 48px;
}

.ts-loading[hidden] {
  display: none !important;
}

.ts-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ts-spin 0.75s linear infinite;
}

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

.ts-loading p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--sub);
}

.msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}

.msg.err {
  background: color-mix(in srgb, var(--err) 12%, transparent);
  color: var(--err);
}

.msg.ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--ok);
}

.msg[hidden] {
  display: none !important;
}

.pwd-bars {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding: 0 4px;
}

.pwd-bars span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--sub) 20%, transparent);
  transition: background 0.3s;
}

.pwd-bars span.on {
  background: var(--pwd-bar-color, var(--sub));
}

.pwd-status {
  margin: 6px 0 0;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.pwd-status.weak {
  color: #ff5252;
}

.pwd-status.fair {
  color: #ff9800;
}

.pwd-status.strong {
  color: var(--ok);
}

.match-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-left: 4px;
  font-size: 12px;
  font-weight: 600;
}

.match-row.ok {
  color: var(--ok);
}

.match-row.bad {
  color: #ff5252;
}

.view[hidden] {
  display: none !important;
}

.center-spinner {
  text-align: center;
  padding: 48px 16px;
}

.center-spinner .auth-logo-wrap,
.center-spinner .auth-logo-svg {
  margin-bottom: 24px;
}

.center-spinner p {
  color: var(--sub);
  margin-top: 16px;
  font-size: 0.875rem;
}

/* Reset / denied / success hero states — icons must sit on card center axis */
#state-denied,
#state-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.success-icon,
.denied-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 auto 16px;
  line-height: 1;
  flex-shrink: 0;
}

.success-icon {
  font-size: 80px;
  color: var(--ok);
}

.denied-icon {
  font-size: 56px;
  color: var(--sub);
}

.success-icon i,
.denied-icon i {
  display: block;
  width: 1em;
  text-align: center;
  line-height: 1;
}

@media (max-width: 400px) {
  .auth-logo-wrap,
  .auth-logo-svg {
    width: 80px;
    height: calc(80px * 1.1);
    margin-bottom: 24px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .auth-title {
    font-size: 22px;
  }
}
