/* ============================================================
   Auth pages (sign in / register) — shared styles
   Tokenised against colors_and_type.css. No page-local hex.
   ============================================================ */

/* Skip link */
.auth-skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 300;
  background: #fff;
  color: var(--xe-blue);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top 140ms ease;
}
.auth-skip:focus { top: 16px; outline: none; box-shadow: 0 0 0 3px rgba(75,142,255,0.4), var(--shadow-md); }

.auth-page { min-height: 100vh; display: flex; background: linear-gradient(135deg, var(--auth-navy-1) 0%, var(--auth-navy-2) 50%, var(--auth-navy-3) 100%); }

.auth-header { position: absolute; top: 0; left: 0; right: 0; z-index: 200; padding: 20px var(--container-pad); }
.auth-header__inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 40px; }
.auth-logo { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: -0.04em; color: #fff; text-decoration: none; flex-shrink: 0; }
.auth-logo:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(75,142,255,0.4); border-radius: 6px; }
.auth-logo__mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; box-shadow: 0 8px 24px rgba(75, 142, 255, 0.3); }
.auth-nav { display: flex; align-items: center; gap: 16px; margin-left: auto; }

.lang-selector { position: relative; }
.lang-toggle { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 6px 10px; height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 12px; font-weight: 700; color: #fff; cursor: pointer; transition: all 140ms ease; backdrop-filter: blur(10px); }
.lang-toggle:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.3); }
.lang-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(75, 142, 255, 0.3); }
.lang-toggle__label { text-transform: uppercase; letter-spacing: 0.05em; }
.lang-toggle svg { width: 16px; height: 16px; transition: transform 140ms ease; }
.lang-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.lang-menu { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--auth-navy-3); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); z-index: 100; min-width: 120px; }
.lang-item { display: block; width: 100%; padding: 10px 14px; border: none; background: transparent; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.7); cursor: pointer; text-align: left; font-family: inherit; transition: all 140ms ease; }
.lang-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.lang-item.is-active { background: rgba(75, 142, 255, 0.3); color: var(--auth-accent-soft); }
.lang-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(75, 142, 255, 0.6); }

.auth-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 0; width: 100%; min-height: 100vh; }

/* Left side — benefits */
.auth-side { padding: 80px 60px; display: flex; flex-direction: column; justify-content: center; color: #fff; position: relative; overflow: hidden; }
.auth-side::before { content: ""; position: absolute; inset: 0; opacity: 0.05; background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px); background-size: 40px 40px; pointer-events: none; }
.auth-side__content { position: relative; z-index: 1; max-width: 480px; }
.auth-side__title { font-size: 42px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -0.03em; }
.auth-side__subtitle { font-size: 18px; line-height: 1.6; color: rgba(255, 255, 255, 0.7); margin-bottom: 48px; }
.auth-benefits { display: flex; flex-direction: column; gap: 24px; }
.benefit-item { display: flex; gap: 16px; align-items: flex-start; }
.benefit-icon { width: 44px; height: 44px; border-radius: 10px; background: rgba(75, 142, 255, 0.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.benefit-icon svg { width: 22px; height: 22px; color: var(--auth-accent-soft); }
.benefit-text__title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.benefit-text__desc { font-size: 14px; color: rgba(255, 255, 255, 0.6); line-height: 1.5; }

/* Right side — form */
.auth-form-side { padding: 80px 60px; display: flex; flex-direction: column; justify-content: center; background: var(--auth-form-bg); position: relative; overflow-y: auto; max-height: 100vh; }
.auth-form-side::before { content: ""; position: absolute; top: 0; right: 0; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(75, 142, 255, 0.08) 0%, transparent 70%); }
.auth-form-card { position: relative; z-index: 1; max-width: 420px; width: 100%; margin: 0 auto; }
.auth-form-head { margin-bottom: 32px; }
.auth-form-title { font-size: 32px; font-weight: 800; color: var(--auth-navy-1); margin: 0 0 10px; letter-spacing: -0.03em; }
.auth-form-subtitle { font-size: 15px; color: var(--text-secondary); margin: 0; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row .form-group { margin-bottom: 0; }

.form-group input,
.form-group select { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--border-input); border-radius: 10px; font-size: 15px; font-family: inherit; color: var(--text-primary); background: #fff; transition: all 140ms ease; }
.form-group input::placeholder { color: var(--text-tertiary); }
.form-group input:hover,
.form-group select:hover { border-color: var(--border-strong); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.form-group input:focus-visible,
.form-group select:focus-visible { outline: none; border-color: var(--xe-blue-hover); box-shadow: 0 0 0 3px rgba(75, 142, 255, 0.15); }
.form-group input.is-invalid,
.form-group select.is-invalid { border-color: var(--error); }
.form-group input.is-invalid:focus-visible,
.form-group select.is-invalid:focus-visible { border-color: var(--error); box-shadow: 0 0 0 3px rgba(229,72,77,0.15); }

/* Password field with show/hide toggle */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.password-toggle { position: absolute; top: 0; right: 0; height: 46px; width: 44px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--text-tertiary); border-radius: 0 10px 10px 0; transition: color 140ms ease; }
.password-toggle:hover { color: var(--text-primary); }
.password-toggle:focus-visible { outline: none; color: var(--xe-blue-hover); box-shadow: 0 0 0 3px rgba(75,142,255,0.25); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .icon-hide { display: none; }
.password-toggle.is-shown .icon-show { display: none; }
.password-toggle.is-shown .icon-hide { display: block; }

.form-error { font-size: 12px; color: var(--error-text); margin-top: 6px; display: none; }
.form-error.show { display: block; }
/* Server-rendered banners (login/register/forgot/reset-password): always shown when
   present in the DOM, unlike the JS-toggled inline .form-error above. */
.form-error--banner { display: block; font-size: 13px; padding: 10px 14px; margin: 0 0 16px; background: rgba(220,38,38,0.06); border: 1px solid var(--error-text); border-radius: 8px; }
.form-success--banner { display: block; font-size: 13px; color: var(--success-text); padding: 10px 14px; margin: 0 0 16px; background: rgba(15,169,88,0.08); border: 1px solid var(--success-text); border-radius: 8px; }

.password-strength { display: flex; gap: 4px; margin-top: 8px; }
.strength-bar { height: 4px; flex: 1; background: var(--border-default); border-radius: 2px; transition: background 200ms ease; }
.strength-bar.weak   { background: var(--error); }
.strength-bar.fair   { background: var(--warning); }
.strength-bar.good   { background: var(--info); }
.strength-bar.strong { background: var(--success); }
.strength-text { font-size: 11px; margin-top: 4px; font-weight: 600; color: var(--text-tertiary); }
.strength-text.weak   { color: var(--error-text); }
.strength-text.fair   { color: var(--warning-text); }
.strength-text.good   { color: var(--info); }
.strength-text.strong { color: var(--success-text); }

.checkbox-group { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; accent-color: var(--xe-blue-hover); }
.checkbox-group input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(75,142,255,0.3); border-radius: 4px; }
.checkbox-group label { font-size: 13px; color: var(--text-secondary); cursor: pointer; flex: 1; line-height: 1.4; }
.checkbox-group label a { color: var(--xe-blue); text-decoration: none; font-weight: 600; }
.checkbox-group label a:hover { color: var(--xe-blue-active); text-decoration: underline; }

.forgot-link { display: flex; justify-content: flex-end; margin-bottom: 24px; }
.forgot-link a { font-size: 13px; color: var(--xe-blue); text-decoration: none; font-weight: 600; transition: all 140ms ease; }
.forgot-link a:hover { color: var(--xe-blue-active); text-decoration: underline; }

.btn-signin, .btn-signup { height: 48px; padding: 0 24px; background: linear-gradient(135deg, var(--xe-blue-hover) 0%, var(--xe-blue-active) 100%); color: #fff; font-size: 16px; font-weight: 600; border: none; border-radius: 10px; cursor: pointer; transition: all 140ms ease; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; box-shadow: 0 8px 24px rgba(22, 59, 255, 0.25); }
.btn-signup { margin-top: 8px; }
.btn-signin:hover, .btn-signup:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(22, 59, 255, 0.35); }
.btn-signin:active, .btn-signup:active { transform: translateY(0); }
.btn-signin:disabled, .btn-signup:disabled { background: var(--btn-disabled); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-signin:focus-visible, .btn-signup:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(22,59,255,0.25), 0 8px 24px rgba(22, 59, 255, 0.25); }
.btn-signin .spinner, .btn-signup .spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 600ms linear infinite; }

.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-default); }
.divider__text { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }

.btn-google { height: 48px; padding: 0 24px; background: #fff; color: var(--text-primary); font-size: 15px; font-weight: 600; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; transition: all 140ms ease; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.btn-google:hover { background: var(--bg-secondary); border-color: var(--xe-blue-hover); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.btn-google:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(22,59,255,0.2); }
.btn-google:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-google svg { width: 20px; height: 20px; }

/* Supabase Auth inline disclosure (login.twig/register.twig) — a same-page form reveal,
   not a link to another page, so <summary> reuses .btn-google's look with its native
   marker removed rather than a fresh button style. */
.sso-details summary { list-style: none; }
.sso-details summary::-webkit-details-marker { display: none; }
.sso-details summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(22,59,255,0.2); }
.sso-details[open] summary { margin-bottom: 16px; }
.sso-details form { display: flex; flex-direction: column; gap: 16px; }

.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--xe-blue); text-decoration: none; font-weight: 600; transition: color 140ms ease; }
.auth-footer a:hover { color: var(--xe-blue-active); text-decoration: underline; }

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

@media (prefers-reduced-motion: reduce) {
  .btn-signin, .btn-signup, .btn-google { transition: none; }
  .btn-signin:hover, .btn-signup:hover, .btn-google:hover { transform: none; }
}

@media (max-width: 1024px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-side { padding: 60px 40px; }
  .auth-side__title { font-size: 36px; }
  .auth-form-side { padding: 60px 40px; }
}

@media (max-width: 640px) {
  .auth-header { padding: 16px var(--container-pad); }
  .auth-side { display: none; }
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-form-side { padding: 40px 24px; }
  .auth-form-card { max-width: 100%; }
  .auth-form-title { font-size: 28px; }
  .form-row { grid-template-columns: 1fr; }
}
