/* =========================================================================
   Flockopay — auth pages (signin, signup) styling
   ========================================================================= */

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 500px at 50% 0%, rgba(59,130,246,0.18), transparent 60%),
    radial-gradient(ellipse 500px 400px at 0% 100%, rgba(251,191,36,0.06), transparent 60%),
    radial-gradient(ellipse 500px 400px at 100% 100%, rgba(251,113,133,0.06), transparent 60%);
}
.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.035) 1px, transparent 0);
  background-size: 30px 30px;
}

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

.auth-logo-out {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
}
.auth-logo-out:hover { transform: translateY(-2px); }
.auth-logo-out img { width: 36px; height: 36px; }
.auth-logo-out .brand-name {
  background: linear-gradient(135deg, var(--fg) 0%, #b4c4e3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: rgba(15, 22, 38, 0.78);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow:
    0 30px 80px -20px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  overflow: hidden;
}

/* Glow border rotation */
.auth-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 24px;
  padding: 2px;
  background: conic-gradient(
    from var(--auth-angle, 0deg),
    transparent 0%,
    rgba(59,130,246,0.35) 20%,
    transparent 40%,
    transparent 60%,
    rgba(251,191,36,0.3) 80%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: rotateAuthAngle 12s linear infinite;
  pointer-events: none;
  opacity: 0.5;
}
@property --auth-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes rotateAuthAngle { to { --auth-angle: 360deg; } }

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  text-align: center;
}
.auth-sub {
  color: var(--fg-muted);
  font-size: 14px;
  text-align: center;
  margin: 0 0 24px;
  line-height: 1.55;
}

/* STEPS indicator */
.auth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.step-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s cubic-bezier(.2,.8,.2,1);
}
.step-label {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.3s;
}
.step.is-active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.18);
}
.step.is-active .step-label { color: var(--fg); }
.step.is-done .step-circle {
  background: var(--mint);
  border-color: var(--mint);
  color: var(--bg);
}
.step.is-done .step-circle::after {
  content: '✓';
  font-size: 14px;
  font-weight: 700;
}
.step.is-done .step-circle > * { display: none; }
.step-line {
  flex: 0 1 60px;
  height: 1px;
  background: var(--border);
  margin-bottom: 18px;
  position: relative;
}
.step-line.is-done {
  background: var(--mint);
}

/* STEP PANES */
.auth-step-pane {
  display: none;
  animation: paneIn 0.4s cubic-bezier(.2,.8,.2,1);
}
.auth-step-pane.is-current { display: block; }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* FIELDS */
.field { margin-bottom: 16px; position: relative; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.field-label-row label { margin: 0; }
.forgot-link {
  font-size: 12.5px;
  color: var(--primary);
}
.forgot-link:hover { color: var(--primary-hover); text-decoration: underline; }

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 14.5px;
  font-family: inherit;
  transition: all 0.25s cubic-bezier(.2,.8,.2,1);
}
.field input::placeholder { color: var(--fg-dim); }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.16);
  transform: translateY(-1px);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%239aa6c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Field state — invalid */
.field.is-invalid input,
.field.is-invalid select {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(251,113,133,0.10);
}
.field.is-valid input {
  border-color: rgba(52,211,153,0.6);
}
.field-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--coral);
  min-height: 0;
  opacity: 0;
  transform: translateY(-2px);
  transition: all 0.25s;
}
.field.is-invalid .field-error {
  opacity: 1;
  transform: translateY(0);
}

/* INPUT WRAP (password toggle) */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.toggle-pwd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim);
  border-radius: 6px;
  transition: all 0.2s;
}
.toggle-pwd:hover { color: var(--fg); background: rgba(255,255,255,0.05); }
.toggle-pwd svg { width: 16px; height: 16px; }

/* PASSWORD METER */
.pwd-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg-dim);
}
.pwd-meter-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-elev-2);
  border-radius: 2px;
  overflow: hidden;
}
.pwd-meter-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--coral);
  border-radius: 2px;
  transition: width 0.3s, background-color 0.3s;
}
.pwd-meter.is-1 .pwd-meter-bar span { width: 25%; background: #ef4444; }
.pwd-meter.is-2 .pwd-meter-bar span { width: 50%; background: var(--accent); }
.pwd-meter.is-3 .pwd-meter-bar span { width: 75%; background: #84cc16; }
.pwd-meter.is-4 .pwd-meter-bar span { width: 100%; background: var(--mint); }
.pwd-meter-label { flex-shrink: 0; }

/* CHECKBOX */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark {
  flex-shrink: 0;
  margin-top: 2px;
  width: 18px;
  height: 18px;
  background: var(--bg-elev-1);
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  position: relative;
  transition: all 0.2s;
}
.checkbox input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox input:checked + .checkmark::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox a { color: var(--primary); }
.checkbox a:hover { text-decoration: underline; }

/* BUTTONS in forms */
.btn-block { width: 100%; }
.btn .btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading .btn-text { display: none; }
.btn.is-loading .btn-spinner { display: inline-block; }

/* AUTH ACTIONS (back + submit) */
.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.auth-actions .btn-ghost { flex: 0 0 auto; }
.auth-actions .btn-primary { flex: 1; }

/* DIVIDER */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-dim);
  font-size: 12px;
  margin: 22px 0 14px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* OAUTH BUTTONS */
.oauth-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.2,.8,.2,1);
}
.oauth-btn:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* AUTH FOOT */
.auth-foot {
  text-align: center;
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 18px 0 0;
}
.auth-foot a { color: var(--primary); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

/* AUTH ALERT (errors) */
.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(251,113,133,0.10);
  border: 1px solid rgba(251,113,133,0.35);
  color: var(--coral);
  font-size: 13.5px;
  margin: 8px 0 14px;
  animation: alertIn 0.3s cubic-bezier(.2,.8,.2,1);
}
.auth-alert svg { width: 18px; height: 18px; flex-shrink: 0; }
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AUTH TRUST footer line */
.auth-trust {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  font-size: 12px;
}
.auth-trust svg { width: 14px; height: 14px; }

/* AUTH SUCCESS (step 3) */
.auth-success {
  text-align: center;
  padding: 8px 0;
}
.auth-next-list {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  text-align: left;
}
.next-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--fg-muted);
}
.next-step {
  font-weight: 700;
  color: var(--primary);
  width: 22px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

/* SUCCESS CHECK (animated) */
.success-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(52,211,153,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: successPop 0.5s cubic-bezier(.2,1.5,.4,1);
}
.success-check.small { width: 56px; height: 56px; }
.success-check svg {
  width: 40px; height: 40px;
}
.success-check.small svg { width: 28px; height: 28px; }
.success-check svg circle {
  stroke: var(--mint);
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: dashCircle 0.6s cubic-bezier(.65,0,.45,1) forwards;
}
.success-check svg path {
  stroke: var(--mint);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: dashCheck 0.4s 0.35s cubic-bezier(.65,0,.45,1) forwards;
}
@keyframes successPop {
  0% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes dashCircle { to { stroke-dashoffset: 0; } }
@keyframes dashCheck  { to { stroke-dashoffset: 0; } }

/* MODAL (forgot password) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s;
}
.modal-card {
  position: relative;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: modalIn 0.35s cubic-bezier(.2,1.2,.4,1);
}
.modal-card h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.015em;
}
.modal-card > p {
  color: var(--fg-muted);
  font-size: 14px;
  margin: 0 0 20px;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.modal-success { text-align: center; padding: 16px 0; }
.modal-success h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 6px;
}
.modal-success p { color: var(--fg-muted); font-size: 14px; margin: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* MOBILE */
@media (max-width: 540px) {
  .auth-card { padding: 28px 22px; border-radius: 18px; }
  .field-row { grid-template-columns: 1fr; }
  .auth-card h1 { font-size: 22px; }
  .step-line { flex: 0 1 30px; }
  .step-label { display: none; }
}
