/* ============================================================
   CourseFlow — Auth (Login / Register) Styles
   Covers: WP login page reskin + frontend page template
   ============================================================ */

/* ── WP Login page (wp-login.php) ──────────────────────── */
body.cf-login-page,
body.login {
  background: #f1f5f9 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.login #login {
  padding: 20px;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

body.login h1 a {
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  height: 60px;
  width: 200px !important;
  margin-bottom: 16px;
}

body.login #loginform,
body.login #lostpasswordform,
body.login #registerform {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  margin-bottom: 1rem;
}

body.login label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: block;
  margin-bottom: 4px;
}

body.login input[type="text"],
body.login input[type="email"],
body.login input[type="password"] {
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 0.9375rem !important;
  transition: border-color .15s, box-shadow .15s !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.login input[type="text"]:focus,
body.login input[type="email"]:focus,
body.login input[type="password"]:focus {
  border-color: var(--cf-primary, #6366f1) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-primary, #6366f1) 15%, transparent) !important;
  outline: none !important;
}

body.login .button-primary {
  background: var(--cf-primary, #6366f1) !important;
  border-color: var(--cf-primary, #6366f1) !important;
  border-radius: 8px !important;
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  padding: 10px 24px !important;
  text-shadow: none !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--cf-primary, #6366f1) 30%, transparent) !important;
  transition: opacity .15s !important;
  width: 100%;
}

body.login .button-primary:hover { opacity: .88 !important; }

body.login #nav a,
body.login #backtoblog a {
  color: var(--cf-primary, #6366f1) !important;
  font-size: 0.8125rem;
}

body.login .message,
body.login .success,
body.login .notice {
  border-radius: 8px !important;
  border-left-color: var(--cf-primary, #6366f1) !important;
}

/* ── Frontend auth page ──────────────────────────────────── */

.cf-auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}

@media (max-width: 768px) {
  .cf-auth-page { grid-template-columns: 1fr; }
  .cf-auth-panel { display: none; }
}

/* Left panel — brand/illustration */
.cf-auth-panel {
  background: linear-gradient(135deg, var(--cf-primary, #6366f1) 0%, color-mix(in srgb, var(--cf-primary, #6366f1) 70%, #000) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.cf-auth-panel::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  top: -150px; right: -150px;
}
.cf-auth-panel::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  bottom: -80px; left: -80px;
}

.cf-auth-panel__logo { margin-bottom: 3rem; position: relative; z-index: 1; }
.cf-auth-panel__logo img { max-height: 48px; filter: brightness(0) invert(1); }
.cf-auth-panel__logo-text { font-size: 1.5rem; font-weight: 800; color: #fff; }

.cf-auth-panel__headline {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 1rem;
  position: relative; z-index: 1;
}

.cf-auth-panel__sub {
  font-size: 1rem;
  opacity: .8;
  text-align: center;
  max-width: 340px;
  line-height: 1.6;
  position: relative; z-index: 1;
}

.cf-auth-panel__stats {
  display: flex;
  gap: 2rem;
  margin-top: 3rem;
  position: relative; z-index: 1;
}
.cf-auth-panel__stat { text-align: center; }
.cf-auth-panel__stat-value { font-size: 1.5rem; font-weight: 800; }
.cf-auth-panel__stat-label { font-size: 0.75rem; opacity: .7; letter-spacing: .04em; text-transform: uppercase; }

/* Right panel — form */
.cf-auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: #fff;
}

.cf-auth-form-inner {
  width: 100%;
  max-width: 420px;
}

.cf-auth-form-inner .cf-auth-logo {
  margin-bottom: 2.5rem;
  display: block;
}
.cf-auth-form-inner .cf-auth-logo img { max-height: 40px; }

/* Tab switcher (Sign In / Create Account) */
.cf-auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 2rem;
  gap: 4px;
}

.cf-auth-tab {
  flex: 1;
  padding: 0.6rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
  text-decoration: none;
}
.cf-auth-tab.is-active {
  background: #fff;
  color: var(--cf-primary, #6366f1);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* Heading */
.cf-auth-heading { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; color: #0f172a; }
.cf-auth-sub     { font-size: .875rem; color: #64748b; margin-bottom: 1.75rem; }

/* Alert messages */
.cf-auth-alert {
  padding: .875rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  line-height: 1.5;
}
.cf-auth-alert--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.cf-auth-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Form fields */
.cf-auth-form { display: flex; flex-direction: column; gap: 1rem; }

.cf-auth-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 400px) { .cf-auth-field-row { grid-template-columns: 1fr; } }

.cf-auth-field { display: flex; flex-direction: column; gap: 4px; }

.cf-auth-field label {
  font-size: .8125rem;
  font-weight: 600;
  color: #374151;
}

.cf-auth-input {
  padding: .65rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .9375rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
}
.cf-auth-input:focus {
  border-color: var(--cf-primary, #6366f1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-primary, #6366f1) 15%, transparent);
}

/* Password strength indicator */
.cf-auth-password-wrap { position: relative; }
.cf-auth-toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #94a3b8; padding: 4px;
  display: flex; align-items: center;
}
.cf-auth-toggle-pw:hover { color: #475569; }

.cf-pw-strength {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  margin-top: 6px;
  overflow: hidden;
}
.cf-pw-strength__bar {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
  width: 0;
}
.cf-pw-strength--weak   .cf-pw-strength__bar { width: 25%; background: #ef4444; }
.cf-pw-strength--fair   .cf-pw-strength__bar { width: 50%; background: #f59e0b; }
.cf-pw-strength--good   .cf-pw-strength__bar { width: 75%; background: #3b82f6; }
.cf-pw-strength--strong .cf-pw-strength__bar { width: 100%; background: #10b981; }

.cf-pw-strength__label { font-size: .7rem; color: #94a3b8; margin-top: 4px; }

/* Remember / forgot row */
.cf-auth-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8125rem;
}
.cf-auth-meta label { display: flex; align-items: center; gap: .4rem; font-weight: 400; color: #475569; cursor: pointer; }
.cf-auth-meta a { color: var(--cf-primary, #6366f1); text-decoration: none; font-weight: 500; }
.cf-auth-meta a:hover { text-decoration: underline; }

/* Terms checkbox */
.cf-auth-terms { display: flex; align-items: flex-start; gap: .5rem; font-size: .8125rem; color: #475569; }
.cf-auth-terms input { margin-top: 2px; accent-color: var(--cf-primary, #6366f1); flex-shrink: 0; }
.cf-auth-terms a { color: var(--cf-primary, #6366f1); text-decoration: none; }

/* Submit button */
.cf-auth-submit {
  width: 100%;
  padding: .8rem;
  background: var(--cf-primary, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: .01em;
}
.cf-auth-submit:hover { opacity: .9; }
.cf-auth-submit:active { transform: scale(.99); }

/* Divider */
.cf-auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #cbd5e1;
  font-size: .75rem;
  margin: .25rem 0;
}
.cf-auth-divider::before,
.cf-auth-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

/* Social auth buttons */
.cf-auth-socials { display: flex; flex-direction: column; gap: .5rem; }
.cf-auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  cursor: pointer;
  background: #fff;
}
.cf-auth-social-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.cf-auth-social-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Forgot password inline panel */
.cf-auth-reset-panel { display: none; }
.cf-auth-reset-panel.is-active { display: block; }
.cf-auth-back { background: none; border: none; color: var(--cf-primary, #6366f1); font-size: .875rem; font-weight: 500; cursor: pointer; padding: 0; margin-bottom: 1rem; display: flex; align-items: center; gap: .3rem; }

/* Footer link */
.cf-auth-footer { text-align: center; font-size: .8125rem; color: #94a3b8; margin-top: 1.5rem; }
.cf-auth-footer a { color: var(--cf-primary, #6366f1); font-weight: 600; text-decoration: none; }

/* Dark mode */
[data-theme="dark"] .cf-auth-form-wrap { background: #1e293b; }
[data-theme="dark"] .cf-auth-heading { color: #f8fafc; }
[data-theme="dark"] .cf-auth-input { background: #0f172a; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .cf-auth-input:focus { border-color: var(--cf-primary, #6366f1); }
[data-theme="dark"] .cf-auth-tabs { background: #0f172a; }
[data-theme="dark"] .cf-auth-tab.is-active { background: #1e293b; }
