/* ==========================================================================
   SHARED AUTH LAYOUT
   Loaded by: base_account.html for every page under /templates/account/
              (auth, forgot_password, set_password, password_reset_*,
               new_customer, suspended, verify)

   Architecture
   ------------
   All structure, spacing, typography, components — defined ONCE here using
   --auth-* tokens. Defaults are Gumo (navy card + gold accent).
   Brand-specific overrides live in:
       static/css/whitelabel/<brand>/auth.css
   which only re-declare the tokens (no layout rules). This keeps the three
   brand files from drifting out of sync, as they did before consolidation.

   Token cheat-sheet
   -----------------
   --auth-page-bg          page background (behind the card)
   --auth-card-bg          the hero card
   --auth-card-border      border colour for the card (transparent = none)
   --auth-text-primary     primary text on the card
   --auth-text-muted       secondary text on the card
   --auth-text-subtle      tertiary / disclaimer text on the card
   --auth-accent           brand accent — CTA button, active tab, focus ring
   --auth-accent-hover     hover state for accent-filled elements
   --auth-accent-contrast  text colour laid on top of --auth-accent
   --auth-accent-shadow           glow under accent buttons (rgba or var)
   --auth-accent-shadow-strong    stronger glow on hover
   --auth-accent-focus-ring       outer ring on focused inputs (rgba)
   --auth-input-bg         form field background
   --auth-input-text       form field text colour
   --auth-border-on-card   subtle dividers / checkbox borders on dark card
   --auth-decor-rgb-1      background radial #1 — comma-separated r,g,b
   --auth-decor-rgb-2      background radial #2 — comma-separated r,g,b
   --auth-shadow-card      card drop-shadow
   ========================================================================== */

/* ===== TOKENS — GUMO DEFAULTS (brand file may override) ================== */
.auth-section {
    --auth-page-bg: #ffffff;
    --auth-card-bg: #1c2d4d;
    --auth-card-border: transparent;
    --auth-text-primary: #ffffff;
    --auth-text-muted: rgba(255, 255, 255, 0.72);
    --auth-text-subtle: rgba(255, 255, 255, 0.55);
    --auth-accent: #A79479;
    --auth-accent-hover: #A79479;
    --auth-accent-contrast: #ffffff;
    --auth-accent-shadow: rgba(167, 148, 121, 0.35);
    --auth-accent-shadow-strong: rgba(167, 148, 121, 0.45);
    --auth-accent-focus-ring: rgba(167, 148, 121, 0.25);
    --auth-input-bg: #ffffff;
    --auth-input-text: #1c2d4d;
    --auth-border-on-card: rgba(255, 255, 255, 0.18);
    --auth-decor-rgb-1: 204, 226, 252;
    --auth-decor-rgb-2: 167, 148, 121;
    --auth-shadow-card: 0 20px 50px -12px rgba(28, 45, 77, 0.35);

    --auth-font: 'Inter', 'Poppins', sans-serif;
    --auth-radius-sm: 8px;
    --auth-radius-md: 12px;
    --auth-radius-lg: 20px;
    --auth-radius-full: 9999px;
    --auth-shadow-input: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   base_account.html WRAPPER NEUTRALISATION
   base_account still wraps content in .card — these rules let .auth-section
   take over the viewport. Remove once D-9 (structural refactor) lands.
   ========================================================================== */
body > div.d-flex.justify-content-center {
    background: transparent !important;
    min-height: 100vh;
    height: auto !important;
}
body > div .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    max-width: 100%;
}
body > div .card-body { padding: 0; }
body > div .card-body .m-4 { margin: 0 !important; }

html, body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==========================================================================
   LOADER (full-page overlay)
   ========================================================================== */
.auth-loader,
#loader.loader {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--auth-accent);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: auth-spin 0.8s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 100;
}

@keyframes auth-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

#passwordError {
    font-size: 0.8rem;
    color: #fca5a5;
    margin-top: -8px;
    display: none;
}

#registerButton:disabled { opacity: 0.5; cursor: not-allowed; }
#registerButton:enabled  { opacity: 1;   cursor: pointer; }

/* ==========================================================================
   SECTION — page background with brand-tinted radial decorations
   ========================================================================== */
.auth-section {
    position: relative;
    overflow: visible;
    padding: 60px 0 80px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-page-bg);
}

.auth-section::before,
.auth-section::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

.auth-section::before {
    top: -15%;
    left: -10%;
    width: clamp(360px, 50vw, 720px);
    height: clamp(400px, 55vh, 800px);
    background: radial-gradient(ellipse,
        rgba(var(--auth-decor-rgb-1), 0.45) 0%,
        rgba(var(--auth-decor-rgb-1), 0.15) 40%,
        rgba(255, 255, 255, 0)               75%);
}

.auth-section::after {
    bottom: -15%;
    right: -10%;
    width: clamp(360px, 50vw, 720px);
    height: clamp(400px, 55vh, 800px);
    background: radial-gradient(ellipse,
        rgba(var(--auth-decor-rgb-2), 0.25) 0%,
        rgba(var(--auth-decor-rgb-2), 0.08) 40%,
        rgba(255, 255, 255, 0)               75%);
}

/* ==========================================================================
   CARD
   ========================================================================== */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 48px 44px;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-card-border);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-card);
    color: var(--auth-text-primary);
}

.auth-logo-container {
    text-align: center;
    padding-top: 20px;      /* breathing room from card top border */
    padding-bottom: 4px;
    margin-bottom: 28px;
}

.auth-logo-container .logo {
    display: block;
    margin: 0 auto;
    max-height: 96px;
    width: auto;
    filter: brightness(0) invert(1);  /* force logo white on dark card */
}

.auth-logo-container p,
.auth-logo-container .text-muted {
    color: var(--auth-text-muted) !important;
    font-size: 0.8rem;
    margin-top: 10px;
    margin-bottom: 0;
}

.auth-logo-container a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-logo-container a:hover {
    color: var(--auth-text-primary);
}

/* ==========================================================================
   TAB TOGGLE — Log in / Register pill switcher
   ========================================================================== */
.top-section { margin-bottom: 24px; }

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--auth-border-on-card);
    border-radius: var(--auth-radius-full);
}

.auth-tab {
    flex: 1 1 0;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--auth-font);
    color: var(--auth-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--auth-radius-full);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab:hover:not(.is-active) {
    color: var(--auth-text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.auth-tab.is-active {
    background: var(--auth-accent);
    color: var(--auth-accent-contrast);
    box-shadow: 0 2px 8px var(--auth-accent-shadow);
}

.auth-tab:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-info {
    font-size: 0.875rem;
    color: var(--auth-text-muted);
    line-height: 1.5;
    margin: 0 0 4px;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.auth-form input:not([type="checkbox"]),
.auth-form .form-control {
    width: 100%;
    padding: 13px 18px;
    font-size: 0.95rem;
    font-family: var(--auth-font);
    color: var(--auth-input-text);
    background: var(--auth-input-bg);
    border: 1px solid transparent;
    border-radius: var(--auth-radius-md);
    box-shadow: var(--auth-shadow-input);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.auth-form input:not([type="checkbox"]):focus,
.auth-form .form-control:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-accent-focus-ring);
}

.auth-form .form-control::placeholder {
    color: #9ca3af;
}

.auth-form .mb-3 { margin-bottom: 14px; }
.auth-form .form-control.small-input { font-size: 0.95rem; }

/* Password eye toggle */
.auth-form .position-relative .form-control { padding-right: 48px; }

.auth-form .password-toggle {
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s;
}

.auth-form .password-toggle:hover { opacity: 1; }

/* ===== BUTTONS ===== */
.auth-form .btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--auth-radius-full);
    background: var(--auth-accent) !important;
    color: var(--auth-accent-contrast) !important;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 12px var(--auth-accent-shadow);
}

.auth-form .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--auth-accent-shadow-strong);
    background: var(--auth-accent-hover) !important;
}

.auth-form .btn:active { transform: translateY(0); }

.auth-form .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== CHECKBOX + INLINE LINKS ===== */
.auth-form .form-check-input {
    width: 1em;
    height: 1em;
    border-radius: 4px;
    border: 1.5px solid var(--auth-border-on-card);
    background-color: transparent;
}

.auth-form .form-check-input:checked {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
}

.auth-form .form-check-input:focus {
    box-shadow: 0 0 0 3px var(--auth-accent-focus-ring);
}

.auth-form .form-check-label,
.auth-form label {
    font-size: 0.85rem;
    color: var(--auth-text-muted) !important;
    font-family: var(--auth-font);
}

.auth-form .custom-link {
    font-size: 0.85rem;
    color: var(--auth-accent) !important;
    font-weight: 500;
    text-decoration: none;
}

.auth-form .custom-link:hover {
    color: var(--auth-text-primary) !important;
}

.auth-form .row { --bs-gutter-x: 12px; }
.auth-form .row .col .form-control { width: 100%; }

.auth-form .recaptcha-note {
    font-size: 0.7rem;
    color: var(--auth-text-subtle);
    line-height: 1.6;
    margin-top: 18px;
}

.auth-form .recaptcha-note a { color: var(--auth-text-muted); text-decoration: underline; }
.auth-form .recaptcha-note a:hover { color: var(--auth-text-primary); }

/* ==========================================================================
   ALERTS & MESSAGES
   ========================================================================== */
.auth-alert {
    padding: 12px 16px;
    border-radius: var(--auth-radius-md);
    margin-bottom: 18px;
    font-size: 0.875rem;
}

.auth-alert.alert-danger {
    background: rgba(252, 165, 165, 0.15);
    border: 1px solid rgba(252, 165, 165, 0.35);
    color: #fecaca;
}

.auth-alert .btn-close {
    padding: 0.6rem;
    filter: invert(1) brightness(1.5);
}

.registration-closed {
    padding: 18px;
    border-radius: var(--auth-radius-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--auth-border-on-card);
    color: var(--auth-text-primary);
}

.registration-closed .alert-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--auth-text-primary);
}

.registration-closed p,
.registration-closed i {
    color: var(--auth-text-muted);
}

/* ==========================================================================
   INFO PAGES — forgot password, reset done, suspended, etc.
   ========================================================================== */
.auth-card .auth-page-heading {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--auth-text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.auth-card .auth-page-text {
    font-size: 0.95rem;
    color: var(--auth-text-muted);
    line-height: 1.6;
    margin-bottom: 14px;
}

.auth-card .auth-page-text a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-card .auth-page-text a:hover {
    color: var(--auth-text-primary);
}

.auth-card .auth-page-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--auth-accent-contrast);
    background: var(--auth-accent);
    border-radius: var(--auth-radius-full);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 4px 12px var(--auth-accent-shadow);
}

.auth-card .auth-page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--auth-accent-shadow-strong);
    background: var(--auth-accent-hover);
    color: var(--auth-accent-contrast);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
    .auth-section { padding: 40px 16px 60px; }
    .auth-card    { padding: 36px 28px; }
    .auth-tab     { font-size: 0.9rem; padding: 9px 14px; }
}

@media (max-width: 400px) {
    .auth-section { padding: 24px 12px 40px; }
    .auth-card    { padding: 28px 20px; }
    .auth-tabs    { flex-wrap: wrap; }

    .auth-form .row { flex-direction: column; }
    .auth-form .row > .col {
        width: 100%;
        margin-bottom: 12px;
    }
    .auth-form .mb-4.d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
}
