/* =============================================================================
   Consultance.online — Authentication Pages
   Split-panel layout: brand left, form right.
   Mobile: stacked (brand header + form).
   ============================================================================ */

/* ---- Shell --------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 420px 1fr;
}

/* ---- Brand panel (left) -------------------------------------------------- */
.auth-brand {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--color-primary);
    display: flex;
    flex-direction: column;
    padding: var(--space-10) var(--space-8);
    color: #fff;

    /* Subtle dot-grid overlay */
    background-image:
        radial-gradient(circle at 70% 20%, rgba(37,99,235,0.35) 0%, transparent 55%),
        radial-gradient(circle at 20% 80%, rgba(108,76,224,0.25) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='1' cy='1' r='1' fill='rgba(255,255,255,0.04)'/%3E%3C/svg%3E");
    background-size: auto, auto, 24px 24px;
}

.auth-brand__logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font: var(--fw-bold) 20px var(--font-sans);
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-12);
}
.auth-brand__logo span { color: rgba(255,255,255,0.5); }
.auth-brand__logo-img {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.auth-brand__headline {
    font: var(--fw-extrabold) clamp(26px, 3vw, 34px)/1.15 var(--font-sans);
    letter-spacing: -0.025em;
    margin: 0 0 var(--space-4);
    color: #fff;
}

.auth-brand__sub {
    font-size: var(--fs-body-sm);
    line-height: var(--lh-body);
    color: rgba(255,255,255,0.6);
    margin: 0 0 var(--space-8);
    max-width: 320px;
}

.auth-brand__features {
    list-style: none;
    padding: 0;
    margin: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.auth-brand__features li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--fs-body-sm);
    line-height: 1.5;
    color: rgba(255,255,255,0.75);
}
.auth-feature-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(37,99,235,0.35);
    display: grid;
    place-items: center;
    color: #93c5fd;
    margin-top: 1px;
}
.auth-feature-icon svg { display: block; }
.auth-brand__features strong {
    display: block;
    font-weight: var(--fw-semibold);
    color: #fff;
    margin-bottom: 2px;
}

.auth-brand__testimonial {
    margin-top: var(--space-8);
    padding: var(--space-5) var(--space-5);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
}
.auth-brand__testimonial blockquote {
    margin: 0 0 var(--space-3);
    font-size: var(--fs-body-sm);
    line-height: 1.6;
    color: rgba(255,255,255,0.8);
    font-style: italic;
}
.auth-brand__testimonial cite {
    font-style: normal;
    font-size: var(--fs-caption);
    color: rgba(255,255,255,0.45);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.auth-testimonial-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--grad-cta);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: var(--fw-bold);
    color: #fff;
    flex-shrink: 0;
}

/* ---- Form panel (right) -------------------------------------------------- */
.auth-panel {
    background: var(--surface-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-8);
    min-height: 100vh;
}

.auth-box {
    width: 100%;
    max-width: 460px;
}

/* Mobile logo (hidden on desktop) */
.auth-mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-box__heading {
    font: var(--fw-extrabold) var(--fs-heading-md)/1.2 var(--font-sans);
    letter-spacing: -0.02em;
    color: var(--on-surface);
    margin: 0 0 var(--space-2);
}
.auth-box__sub {
    font-size: var(--fs-body-sm);
    color: var(--on-surface-muted);
    line-height: var(--lh-body);
    margin: 0 0 var(--space-8);
}
.auth-box__sub strong { color: var(--on-surface-variant); font-weight: var(--fw-medium); }

/* ---- Auth form fields ---------------------------------------------------- */
.auth-form { display: flex; flex-direction: column; gap: var(--space-5); }

.auth-field { display: flex; flex-direction: column; gap: var(--space-2); }

.auth-label {
    font: var(--fw-medium) var(--fs-body-sm)/1 var(--font-sans);
    color: var(--on-surface-variant);
    user-select: none;
}
.auth-label .required { color: var(--color-danger); margin-left: 2px; }

.auth-input-wrap { position: relative; }

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-4);
    border: 1.5px solid var(--outline-variant);
    border-radius: var(--radius-md);
    background: var(--surface-bright);
    font: var(--fw-regular) var(--fs-body-md)/1 var(--font-sans);
    color: var(--on-surface);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
}
.auth-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.auth-input.has-error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(186,26,26,0.08);
}
.auth-input::placeholder { color: var(--on-surface-muted); }

/* Password toggle */
.auth-input--password { padding-right: 48px; }
.auth-pw-toggle {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 48px;
    display: grid;
    place-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--on-surface-muted);
    transition: color var(--dur-fast) var(--ease);
    padding: 0;
}
.auth-pw-toggle:hover { color: var(--on-surface-variant); }
.auth-pw-toggle svg { display: block; pointer-events: none; }
.auth-pw-toggle .pw-icon-show { display: block; }
.auth-pw-toggle .pw-icon-hide { display: none; }
.auth-pw-toggle.is-visible .pw-icon-show { display: none; }
.auth-pw-toggle.is-visible .pw-icon-hide { display: block; }

/* Error message */
.auth-field-error {
    font-size: var(--fs-caption);
    color: var(--color-danger);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    line-height: 1.4;
}

/* Hint */
.auth-field-hint {
    font-size: var(--fs-caption);
    color: var(--on-surface-muted);
    line-height: 1.4;
}

/* Honeypot — hidden from users, visible to naive bots */
.auth-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Password strength */
.auth-pw-strength-wrap {
    margin-top: var(--space-2);
}
.auth-pw-strength {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.auth-pw-strength__bar {
    flex: 1;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--outline-variant);
    transition: background 0.2s ease, transform 0.2s ease;
}
.auth-pw-strength.is-active .auth-pw-strength__bar {
    transform: scaleY(1.1);
}
.auth-pw-strength[data-level="1"] .auth-pw-strength__bar:nth-child(1) { background: #ef4444; }
.auth-pw-strength[data-level="2"] .auth-pw-strength__bar:nth-child(-n+2) { background: #f59e0b; }
.auth-pw-strength[data-level="3"] .auth-pw-strength__bar:nth-child(-n+3) { background: #10b981; }
.auth-pw-strength[data-level="4"] .auth-pw-strength__bar { background: #059669; }
.auth-pw-strength__label {
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    color: var(--on-surface-muted);
    min-width: 72px;
    text-align: right;
    line-height: 1.2;
    flex-shrink: 0;
}
.auth-pw-strength__label--l1 { color: #ef4444; }
.auth-pw-strength__label--l2 { color: #d97706; }
.auth-pw-strength__label--l3 { color: #059669; }
.auth-pw-strength__label--l4 { color: #047857; }

.auth-pw-criteria {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: var(--fs-caption);
    color: var(--on-surface-muted);
}
.auth-pw-criteria li {
    display: flex;
    align-items: center;
    gap: 6px;
}
.auth-pw-criteria li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--outline-variant);
    flex-shrink: 0;
}
.auth-pw-criteria li.is-met {
    color: var(--on-surface);
}
.auth-pw-criteria li.is-met::before {
    background: #10b981;
}

.auth-field-hint--error { color: var(--color-danger); }
.auth-field-hint--ok { color: #059669; }

#register-client-errors {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: #fef2f2;
    color: var(--color-danger);
    font-size: var(--fs-body-sm);
}
/* .auth-flash { display: flex } would otherwise override the hidden attribute */
#register-client-errors[hidden] {
    display: none !important;
}

/* Row group (two fields side by side) */
.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* ---- Divider ------------------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--on-surface-muted);
    font-size: var(--fs-caption);
    margin: var(--space-2) 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--outline-variant);
}

/* ---- Checkbox row -------------------------------------------------------- */
.auth-check-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--fs-body-sm);
    color: var(--on-surface-variant);
    line-height: 1.5;
}
.auth-check-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    cursor: pointer;
    accent-color: var(--color-accent);
}
.auth-check-row a { color: var(--color-accent); }

/* ---- Submit btn ---------------------------------------------------------- */
.auth-submit {
    width: 100%;
    height: 52px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font: var(--fw-semibold) var(--fs-body-md)/1 var(--font-sans);
    letter-spacing: 0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    box-shadow: 0 1px 2px rgba(37,99,235,0.2), 0 4px 12px rgba(37,99,235,0.2);
    position: relative;
    overflow: hidden;
}
.auth-submit:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 4px 16px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* Shimmer on loading */
.auth-submit.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.18) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: auth-shimmer 1.4s infinite;
}
@keyframes auth-shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ---- Footer link --------------------------------------------------------- */
.auth-box__footer {
    margin-top: var(--space-6);
    text-align: center;
    font-size: var(--fs-body-sm);
    color: var(--on-surface-muted);
}
.auth-box__footer a {
    color: var(--color-accent);
    font-weight: var(--fw-medium);
    text-decoration: none;
}
.auth-box__footer a:hover { text-decoration: underline; }

.auth-box__back {
    text-align: center;
    margin-top: var(--space-4);
    font-size: var(--fs-caption);
}
.auth-box__back a { color: var(--on-surface-muted); text-decoration: none; }
.auth-box__back a:hover { color: var(--on-surface-variant); text-decoration: underline; }

/* ---- Flash messages (in-panel) ------------------------------------------ */
.auth-flash {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--fs-body-sm);
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}
.auth-flash svg { flex-shrink: 0; margin-top: 1px; }
.auth-flash--error   { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.auth-flash--success { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }
.auth-flash--info    { background: #eff6ff; color: #1e3a5f; border: 1px solid #bfdbfe; }

/* ---- Mobile top bar (menu + logo; pairs with mobile-shell.css) ----------- */
.auth-mobile-bar {
    display: none;
}

@media (max-width: 900px) {
    .auth-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);
        position: sticky;
        top: 0;
        z-index: var(--z-header);
        min-height: var(--mobile-header-height);
        padding: 0 var(--gutter);
        background: color-mix(in srgb, var(--surface-bright) 92%, transparent);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--outline-variant);
        box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    }

    .auth-mobile-bar__logo {
        flex-shrink: 0;
    }

    .auth-mobile-bar__menu {
        display: inline-flex;
        margin-left: auto;
    }
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: calc(100vh - var(--mobile-header-height));
    }
    .auth-brand { display: none; }
    .auth-mobile-logo { display: none; }
    .auth-panel {
        padding: var(--space-8) var(--space-5);
        align-items: flex-start;
        padding-top: var(--space-6);
    }
}

@media (max-width: 480px) {
    .auth-form-row { grid-template-columns: 1fr; }
    .auth-panel { padding: var(--space-6) var(--space-4); }
}

/* ---- Role picker (register) ---------------------------------------------- */
.role-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px;
    background: var(--surface);
    border: 1.5px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s, box-shadow .15s;
    width: 100%;
}

.role-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.role-card.is-selected {
    border-color: var(--color-accent);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.role-card__icon {
    color: var(--color-accent);
    margin-bottom: 2px;
    line-height: 0;
}

.role-card__title {
    font: var(--fw-semibold) var(--fs-body-md)/1.2 var(--font-sans);
    color: var(--on-surface);
}

.role-card__sub {
    font-size: 12px;
    color: var(--on-surface-muted);
    line-height: 1.4;
}

.role-card__check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
}

.role-card.is-selected .role-card__check {
    display: flex;
}

/* ---- Auth utility cards (verify email, etc.) ----------------------------- */
.auth-card {
    text-align: center;
}

.auth-card__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-accent) 12%, white);
    color: var(--color-accent);
    font-size: 1.75rem;
}

.auth-card__title {
    font: var(--fw-extrabold) var(--fs-heading-md)/1.2 var(--font-sans);
    margin: 0 0 var(--space-2);
    color: var(--on-surface);
}

.auth-card__sub {
    margin: 0;
    font-size: var(--fs-body-sm);
    line-height: 1.55;
    color: var(--on-surface-muted);
}

.auth-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    margin-top: var(--space-5);
}
