/* ============================================================================
 * tsync-auth.css — Shared brand styling for all public auth surfaces.
 *
 * Introduced in v4.2.7 P2.3 to deduplicate the brand-panel CSS between staff
 * login (application/views/authentication/*) and client portal login
 * (application/views/themes/tsync/views/login.php), and to provide a single
 * defensive source for the --tsx-* tokens used by both. Vendor portal login
 * (modules/tsync_purchases/views/vendor_portal/login.php) also includes
 * this file so the four authentication surfaces share visual identity.
 *
 * The file is included in governance_allowlist.json:branding_surfaces[]
 * (per P2.4) because it intentionally ships hardcoded brand colors that
 * are part of the visual identity — the design-token sweep does not run
 * against this file.
 * ========================================================================= */

/* Defensive fallback for the --tsx-* token system. The canonical source
 * is tsync_design_tokens.css; this block guarantees the brand still
 * renders if the token file fails to load (CDN miss, cache, plugin conflict).
 * Per P2.3 — the user reported `--tsx-bg` undefined on /authentication/login. */
:root {
    --tsx-brand-700:        var(--tsync-color-primary, #0d7a8a);
    --tsx-brand-800:        #084d59;
    --tsx-brand-900:        #063f49;
    --tsx-brand:            var(--tsx-brand-700);
    --tsx-brand-hover:      var(--tsx-brand-800);

    --tsx-bg:               #ffffff;
    --tsx-bg-page:          #f8fafc;
    --tsx-surface:          #ffffff;
    --tsx-border:           rgba(15, 23, 42, 0.12);

    --tsx-text:             #071b33;
    --tsx-n-50:             #f8fafc;
    --tsx-n-100:            #f1f5f9;
    --tsx-n-200:            #e2e8f0;
    --tsx-n-400:            #94a3b8;
    --tsx-n-500:            #64748b;
    --tsx-n-600:            #475569;
    --tsx-n-700:            #334155;
    --tsx-n-800:            #1e293b;
    --tsx-n-900:            #0f172a;
    --tsx-muted:            #64748b;

    --tsx-red:              #dc2626;
    --tsx-blue:             #2563eb;
}

/* ── Split-screen shell ──────────────────────────────────────────────────── */

.tsync-auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--tsx-bg-page);
    position: relative;
}
@media (min-width: 992px) {
    .tsync-auth-shell { flex-direction: row; }
}

/* ── Brand panel (left half) ─────────────────────────────────────────────── */

.tsync-auth-brand {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    color: #ffffff;
    padding: 48px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 600px at 100% 0%, rgba(255,255,255,0.10), transparent 55%),
        radial-gradient(700px 500px at 0% 100%, rgba(255,122,89,0.18), transparent 55%),
        linear-gradient(135deg, var(--tsx-brand-800) 0%, var(--tsx-brand-700) 60%, var(--tsx-brand-900) 100%);
}
@media (min-width: 992px) {
    .tsync-auth-brand {
        display: flex;
        width: 50%;
        max-width: 640px;
    }
}
@media (min-width: 1280px) {
    .tsync-auth-brand { width: 40%; }
}
.tsync-auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
    background-size: 28px 28px;
    opacity: 0.6;
    pointer-events: none;
}
.tsync-auth-brand__inner {
    position: relative;
    z-index: 2;
}
.tsync-auth-brand__logo img,
.tsync-auth-brand img.logo {
    max-height: 72px;
    width: auto;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.20));
    margin-bottom: 56px;
}
.tsync-auth-brand h2 {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 12px;
    color: #ffffff;
}
@media (min-width: 1280px) {
    .tsync-auth-brand h2 { font-size: 38px; }
}
.tsync-auth-brand p {
    color: rgba(255,255,255,0.82);
    font-size: 16px;
    line-height: 1.6;
    max-width: 28rem;
    margin: 0;
}
.tsync-auth-brand__features {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: rgba(255,255,255,0.88);
    font-size: 14px;
}
.tsync-auth-brand__features li {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tsync-auth-brand__features svg,
.tsync-auth-brand__features i {
    width: 18px;
    height: 18px;
    color: rgba(255,255,255,0.85);
    flex-shrink: 0;
}

/* ── Form panel (right half) ─────────────────────────────────────────────── */

.tsync-auth-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
@media (min-width: 640px) {
    .tsync-auth-form-wrap { padding: 40px 32px; }
}
.tsync-auth-card {
    width: 100%;
    max-width: 440px;
}
.tsync-auth-mobile-logo {
    text-align: center;
    margin-bottom: 24px;
}
@media (min-width: 992px) {
    .tsync-auth-mobile-logo { display: none; }
}
.tsync-auth-mobile-logo img {
    max-height: 56px;
    width: auto;
    filter: invert(35%) sepia(85%) saturate(360%) hue-rotate(150deg) brightness(0.85);
}
.tsync-auth-heading {
    text-align: center;
    margin-bottom: 28px;
}
.tsync-auth-heading h1 {
    color: var(--tsx-n-900);
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.25;
}
.tsync-auth-heading p {
    color: var(--tsx-n-500);
    margin: 0;
    font-size: 15px;
}

.tsync-auth-panel {
    background: var(--tsx-surface);
    padding: 32px;
    border-radius: 14px;
    border: 1px solid var(--tsx-border);
    box-shadow: 0 4px 14px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
}

.tsync-auth-panel .form-group {
    margin-bottom: 18px;
}
.tsync-auth-panel label.control-label,
.tsync-auth-panel label[for] {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--tsx-n-700);
    margin-bottom: 6px;
}
.tsync-auth-panel .form-control,
.tsync-auth-panel input[type="email"],
.tsync-auth-panel input[type="password"],
.tsync-auth-panel input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tsx-n-900);
    background: var(--tsx-surface);
    border: 1px solid var(--tsx-n-200);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    font-family: inherit;
}
.tsync-auth-panel .form-control:focus,
.tsync-auth-panel input:focus {
    outline: 0;
    border-color: var(--tsx-brand);
    box-shadow: 0 0 0 3px rgba(13,122,138,0.15);
}

.tsync-auth-panel .checkbox {
    margin: 4px 0 0;
    padding-left: 0;
}
.tsync-auth-panel .checkbox input[type=checkbox] {
    margin-right: 8px;
}
.tsync-auth-panel .checkbox label {
    color: var(--tsx-n-600);
    font-size: 13px;
    font-weight: normal;
}

.tsync-auth-panel .btn-primary,
.tsync-auth-panel button[type="submit"],
.tsync-auth-submit {
    width: 100%;
    background: var(--tsx-brand) !important;
    border-color: var(--tsx-brand) !important;
    color: #ffffff !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.tsync-auth-panel .btn-primary:hover,
.tsync-auth-panel button[type="submit"]:hover,
.tsync-auth-submit:hover {
    background: var(--tsx-brand-hover) !important;
    border-color: var(--tsx-brand-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(13,122,138,0.25);
    color: #ffffff !important;
}

.tsync-auth-panel .btn-default {
    width: 100%;
    background: var(--tsx-surface) !important;
    color: var(--tsx-brand) !important;
    border: 1px solid var(--tsx-brand) !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    margin-top: 10px;
    transition: background 0.15s ease;
}
.tsync-auth-panel .btn-default:hover {
    background: var(--tsx-n-50) !important;
}

.tsync-auth-forgot {
    text-align: center;
    margin-top: 20px;
}
.tsync-auth-forgot a {
    color: var(--tsx-n-500);
    font-size: 13px;
    text-decoration: none;
}
.tsync-auth-forgot a:hover {
    color: var(--tsx-brand);
    text-decoration: underline;
}

.tsync-auth-switch {
    text-align: center;
    font-size: 14px;
    color: var(--tsx-n-600);
    margin: 24px 0 0;
}
.tsync-auth-switch a {
    color: var(--tsx-brand);
    font-weight: 500;
    text-decoration: none;
    margin-left: 4px;
}
.tsync-auth-switch a:hover {
    color: var(--tsx-brand-hover);
    text-decoration: underline;
}

.tsync-auth-copyright {
    text-align: center;
    font-size: 12px;
    color: var(--tsx-n-400);
    margin: 12px 0 0;
}

.tsync-auth-panel .alert,
.tsync-auth-panel .text-danger {
    border-radius: 8px;
    font-size: 13px;
}
.tsync-auth-panel .help-block.text-danger {
    color: var(--tsx-red);
    margin-top: 4px;
    margin-bottom: 0;
}
