/* ==========================================================================
   Cyfendo Redesigned Authentication Stylesheet
   Design System: Cream Canvas, Paper Card, Deep Teal, Newsreader Serif
   ========================================================================== */

body:has(.auth-container) {
  background-color: var(--sand, #F4F1EA) !important;
  color: var(--ink, #162728) !important;
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 140px);
  padding: 3.5rem 1.5rem;
  position: relative;
  background-color: var(--sand, #F4F1EA);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--paper, #FAF8F5);
  border: 1px solid var(--line, hsl(180 14% 84%));
  border-radius: 16px;
  padding: 2.75rem 2.5rem;
  box-shadow: 0 16px 40px hsl(183 34% 13% / .06), 0 1px 3px hsl(183 34% 13% / .04);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal, #276468) 0%, var(--teal-light, #348388) 50%, var(--gold, #F7CD59) 100%);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-badge {
  display: inline-block;
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: hsl(183 45% 28% / .08);
  color: var(--teal, #276468);
  border: 1px solid hsl(183 45% 28% / .2);
  margin-bottom: 1rem;
}

.auth-title {
  font-family: var(--font-display, "Newsreader", serif);
  font-size: 2.2rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink, #162728);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-subtitle {
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.95rem;
  color: var(--ink-soft, #5A6D6E);
  line-height: 1.55;
  margin: 0;
}

.auth-alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.auth-alert.alert-error {
  background: hsl(0 84% 96%);
  border: 1px solid hsl(0 84% 82%);
  color: #991b1b;
}

.auth-alert.alert-success {
  background: hsl(142 76% 95%);
  border: 1px solid hsl(142 76% 80%);
  color: #166534;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.form-group label,
.label-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink, #162728);
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--paper-bright, #FFFFFF);
  border: 1px solid var(--line, hsl(180 14% 84%));
  border-radius: 8px;
  color: var(--ink, #162728);
  font-size: 0.95rem;
  font-family: var(--font-sans, "Manrope", sans-serif);
  transition: all var(--transition-fast, 0.15s ease);
  box-sizing: border-box;
}

.form-input::placeholder {
  color: hsl(183 15% 65%);
}

.form-input:focus {
  outline: none;
  border-color: var(--teal, #276468);
  box-shadow: 0 0 0 3px hsl(183 45% 28% / .15);
  background: #FFFFFF;
}

.form-input[aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px hsl(0 84% 60% / .15);
}

.btn-primary-block {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.95rem;
  background: var(--teal, #276468);
  color: #FFFFFF;
  border: 1px solid var(--teal, #276468);
  border-radius: 8px;
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  cursor: pointer;
  box-shadow: 0 4px 14px hsl(183 45% 28% / .2);
  transition: all var(--transition-normal, 0.2s ease);
  margin-top: 0.5rem;
}

.btn-primary-block:hover {
  background: var(--teal-dark, #1c4a4d);
  border-color: var(--teal-dark, #1c4a4d);
  box-shadow: 0 6px 18px hsl(183 45% 28% / .3);
  transform: translateY(-1px);
}

.btn-primary-block:active {
  transform: translateY(0);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted, hsl(183 15% 37%));
  font-family: var(--font-mono, "DM Mono", monospace);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line, hsl(180 14% 84%));
}

.auth-divider span {
  padding: 0 0.85rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.9rem;
  color: var(--ink-soft, #5A6D6E);
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.auth-link {
  color: var(--teal, #276468);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.35rem;
  transition: color var(--transition-fast, 0.15s ease);
}

.auth-link:hover {
  color: var(--teal-dark, #1c4a4d);
  text-decoration: underline;
}

/* ==========================================================================
   Google Single Sign-On (SSO)
   ========================================================================== */
.sso-group {
  margin-bottom: 1.25rem;
}

.btn-google-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: #FFFFFF;
  border: 1px solid var(--line, hsl(180 14% 84%));
  border-radius: 8px;
  color: var(--ink, #162728);
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-decoration: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  cursor: pointer;
  box-shadow: 0 2px 6px hsl(183 34% 13% / .04);
}

.btn-google-sso:hover {
  background: var(--sand-light, #FAF8F5);
  border-color: hsl(180 14% 75%);
  box-shadow: 0 4px 12px hsl(183 34% 13% / .08);
  transform: translateY(-1px);
  color: var(--ink, #162728);
}

.btn-google-sso:active {
  transform: translateY(0);
}

.btn-google-sso .google-icon {
  flex-shrink: 0;
}

.auth-helper-note {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: hsl(183 45% 28% / .05);
  border: 1px solid hsl(183 45% 28% / .15);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft, #5A6D6E);
  line-height: 1.5;
  text-align: center;
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.auth-helper-note strong {
  color: var(--ink, #162728);
}

/* ==========================================================================
   Password Input Enhancements & Live Complexity Feedback
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .form-input {
  padding-right: 3rem;
  min-height: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 0.25rem;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--text-muted, hsl(183 15% 37%));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
  transition: color var(--transition-fast, 0.15s ease);
}

.password-toggle-btn:hover {
  color: var(--teal, #276468);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--teal, #276468);
  outline-offset: 2px;
}

.form-input:focus-visible {
  outline: 2px solid var(--teal, #276468);
  outline-offset: 1px;
}

.btn-primary-block:focus-visible {
  outline: 2px solid var(--teal, #276468);
  outline-offset: 3px;
}

/* Password Strength Indicator */
.password-strength-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.strength-bar-track {
  width: 100%;
  height: 6px;
  background: hsl(180 14% 86%);
  border-radius: 999px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.strength-bar-fill.strength-weak {
  width: 25%;
  background-color: #dc2626;
}

.strength-bar-fill.strength-fair {
  width: 50%;
  background-color: #d97706;
}

.strength-bar-fill.strength-good {
  width: 75%;
  background-color: #0284c7;
}

.strength-bar-fill.strength-strong {
  width: 100%;
  background-color: #16a34a;
}

.strength-label {
  font-size: 0.8rem;
  color: var(--ink-soft, #5A6D6E);
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.strength-label strong {
  font-weight: 600;
  transition: color 0.2s ease;
}

.strength-label strong.strength-weak {
  color: #dc2626;
}

.strength-label strong.strength-fair {
  color: #d97706;
}

.strength-label strong.strength-good {
  color: #0284c7;
}

.strength-label strong.strength-strong {
  color: #16a34a;
}

/* Password Criteria Checklist Box */
.password-criteria-box {
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--sand, #F4F1EA);
  border: 1px solid var(--line, hsl(180 14% 84%));
  border-radius: 8px;
}

.criteria-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink, #162728);
  font-family: var(--font-mono, "DM Mono", monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.45rem;
}

.criteria-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.criterion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted, hsl(183 15% 37%));
  font-family: var(--font-sans, "Manrope", sans-serif);
  transition: color 0.2s ease;
}

.criterion .crit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.criterion .crit-icon-unmet {
  stroke: var(--ink-muted, #7E9293);
  display: block;
  transition: stroke 0.2s ease;
}

.criterion .crit-icon-met {
  stroke: #16a34a;
  display: none;
}

.criterion.met {
  color: var(--ink, #162728);
}

.criterion.met .crit-icon-unmet {
  display: none !important;
}

.criterion.met .crit-icon-met {
  display: block !important;
  stroke: #16a34a;
}

.criterion.met .crit-text {
  color: #15803d;
  font-weight: 600;
}

/* Confirm Password Match Hint */
.confirm-match-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  margin-top: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-sans, "Manrope", sans-serif);
}

.confirm-match-hint.match-success {
  color: #15803d;
  background: hsl(142 76% 94%);
  border: 1px solid hsl(142 76% 80%);
}

.confirm-match-hint.match-error {
  color: #b91c1c;
  background: hsl(0 84% 96%);
  border: 1px solid hsl(0 84% 82%);
}

/* Icon Wrappers (Forgot, Reset, Verify) */
.forgot-icon-wrapper,
.reset-icon-wrapper,
.verify-icon-wrapper {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 1.25rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(183 45% 28% / .08);
  border: 2px solid hsl(183 45% 28% / .2);
  color: var(--teal, #276468);
}

.reset-icon-form {
  background: hsl(183 45% 28% / .08);
  border: 2px solid hsl(183 45% 28% / .2);
  color: var(--teal, #276468);
}

.reset-icon-error,
.verify-icon-error {
  background: hsl(0 84% 60% / .1);
  border: 2px solid hsl(0 84% 60% / .3);
  color: #dc2626;
}

.verify-icon-success {
  background: hsl(142 76% 36% / .1);
  border: 2px solid hsl(142 76% 36% / .3);
  color: #16a34a;
}

.verify-icon-pending {
  background: hsl(183 45% 28% / .08);
  border: 2px solid hsl(183 45% 28% / .2);
  color: var(--teal, #276468);
}

.email-highlight {
  color: var(--teal, #276468);
  font-weight: 700;
  word-break: break-all;
}

.resend-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line, hsl(180 14% 84%));
  text-align: center;
}

@media (max-width: 600px) {
  .auth-container {
    padding: 2rem 1rem;
  }

  .auth-card {
    padding: 2rem 1.25rem;
  }

  .form-row {
    flex-direction: column;
    gap: 1rem;
  }

  .form-input {
    font-size: 16px !important;
  }
}

/* Reduced Motion Optimization for Accessibility */
@media (prefers-reduced-motion: reduce) {
  .strength-bar-fill,
  .criterion,
  .confirm-match-hint,
  .password-toggle-btn,
  .form-input,
  .btn-primary-block,
  .btn-google-sso {
    transition: none !important;
    animation: none !important;
  }
}
