/*
 * FreightBrokerLeads.ai — Base + Typography
 * Sets global defaults (font, rendering, link colors, focus rings) and the
 * type scale utility classes that match DESIGN.md §3 exactly.
 */

html,
body {
    font-family: var(--font-sans);
    font-feature-settings: var(--font-features);
    background-color: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-size: 16px;
    font-weight: var(--fw-reg);
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
}

/* Selection */
::selection {
    background: var(--accent);
    color: #ffffff;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color 120ms ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Focus ring — visible in both modes */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Mono */
code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-feature-settings: normal;
}

/* ---------- Type scale (matches DESIGN.md §3) ---------- */
.t-display-xl {
    font-size: 4.5rem;
    font-weight: var(--fw-med);
    line-height: 1;
    letter-spacing: -1.584px;
}

.t-display-lg {
    font-size: 4rem;
    font-weight: var(--fw-med);
    line-height: 1;
    letter-spacing: -1.408px;
}

.t-display {
    font-size: 3rem;
    font-weight: var(--fw-med);
    line-height: 1;
    letter-spacing: -1.056px;
}

.t-h1 {
    font-size: 2rem;
    font-weight: var(--fw-reg);
    line-height: 1.13;
    letter-spacing: -0.704px;
}

.t-h2 {
    font-size: 1.5rem;
    font-weight: var(--fw-reg);
    line-height: 1.33;
    letter-spacing: -0.288px;
}

.t-h3 {
    font-size: 1.25rem;
    font-weight: var(--fw-semi);
    line-height: 1.33;
    letter-spacing: -0.24px;
}

.t-body-lg {
    font-size: 1.125rem;
    font-weight: var(--fw-reg);
    line-height: 1.6;
    letter-spacing: -0.165px;
}

.t-body-em {
    font-size: 1.0625rem;
    font-weight: var(--fw-semi);
    line-height: 1.6;
}

.t-body {
    font-size: 1rem;
    font-weight: var(--fw-reg);
    line-height: 1.5;
}

.t-body-med {
    font-size: 1rem;
    font-weight: var(--fw-med);
    line-height: 1.5;
}

.t-body-semi {
    font-size: 1rem;
    font-weight: var(--fw-semi);
    line-height: 1.5;
}

.t-small {
    font-size: 0.9375rem;
    font-weight: var(--fw-reg);
    line-height: 1.6;
    letter-spacing: -0.165px;
}

.t-small-med {
    font-size: 0.9375rem;
    font-weight: var(--fw-med);
    line-height: 1.6;
    letter-spacing: -0.165px;
}

.t-small-semi {
    font-size: 0.9375rem;
    font-weight: var(--fw-semi);
    line-height: 1.6;
    letter-spacing: -0.165px;
}

.t-small-light {
    font-size: 0.9375rem;
    font-weight: var(--fw-light);
    line-height: 1.47;
    letter-spacing: -0.165px;
}

.t-caption-lg {
    font-size: 0.875rem;
    font-weight: var(--fw-med);
    line-height: 1.5;
    letter-spacing: -0.182px;
}

.t-caption {
    font-size: 0.8125rem;
    font-weight: var(--fw-reg);
    line-height: 1.5;
    letter-spacing: -0.13px;
}

.t-label {
    font-size: 0.75rem;
    font-weight: var(--fw-reg);
    line-height: 1.4;
}

.t-micro {
    font-size: 0.6875rem;
    font-weight: var(--fw-med);
    line-height: 1.4;
}

.t-tiny {
    font-size: 0.625rem;
    font-weight: var(--fw-reg);
    line-height: 1.5;
    letter-spacing: -0.15px;
}

.t-mono {
    font-family: var(--font-mono);
    font-feature-settings: normal;
    font-size: 0.875rem;
    line-height: 1.5;
}

.t-mono-caption {
    font-family: var(--font-mono);
    font-feature-settings: normal;
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* Default heading styles — unclass'd h1-h6 still get sane tokenized values */
h1 {
    font-size: 2rem;
    font-weight: var(--fw-reg);
    line-height: 1.13;
    letter-spacing: -0.704px;
    color: var(--text-primary);
    margin: 0 0 var(--s-7);
}

h2 {
    font-size: 1.5rem;
    font-weight: var(--fw-reg);
    line-height: 1.33;
    letter-spacing: -0.288px;
    color: var(--text-primary);
    margin: 0 0 var(--s-6);
}

h3 {
    font-size: 1.25rem;
    font-weight: var(--fw-semi);
    line-height: 1.33;
    letter-spacing: -0.24px;
    color: var(--text-primary);
    margin: 0 0 var(--s-4);
}

h4 {
    font-size: 1.0625rem;
    font-weight: var(--fw-semi);
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 var(--s-4);
}

h5 {
    font-size: 1rem;
    font-weight: var(--fw-semi);
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0 0 var(--s-4);
}

h6 {
    font-size: 0.9375rem;
    font-weight: var(--fw-semi);
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 var(--s-4);
}

p {
    color: var(--text-secondary);
    margin: 0 0 var(--s-7);
}

/* Utility helpers */
.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-quaternary {
    color: var(--text-quaternary);
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-warn {
    color: var(--warn-text);
}

.text-danger {
    color: var(--danger-text);
}

.text-brand {
    color: var(--brand);
}

.uppercase {
    text-transform: uppercase;
}

.mono {
    font-family: var(--font-mono);
    font-feature-settings: normal;
}

/* ---------- Admin sub-page shell (shared across /admin/* pages) ---------- */
.admin-subpage {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--s-13) var(--s-7) var(--s-16);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: var(--s-11);
}

.admin-subpage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-7);
}

.admin-subpage-title h1 {
    margin: 0 0 var(--s-2);
    font-size: 1.75rem;
    font-weight: var(--fw-reg);
    line-height: 1.2;
    letter-spacing: -0.704px;
}

.admin-subpage-title p {
    margin: 0;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
}

.admin-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-standard);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: var(--fw-med);
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.admin-back:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
    text-decoration: none;
}

.admin-loading-shared {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-4);
    padding: var(--s-15) 0;
    color: var(--text-tertiary);
}

/* ---------- Account / Auth shell (Login, Register, Forgot/Reset, 2FA, etc.) ---------- */
.auth-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--s-15) var(--s-7) var(--s-16);
    color: var(--text-primary);
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(0, 360px);
    gap: var(--s-15);
    align-items: start;
    justify-content: center;
}

.auth-grid.single {
    grid-template-columns: minmax(0, 460px);
}

.auth-header {
    margin-bottom: var(--s-11);
}

.auth-header h1 {
    margin: 0 0 var(--s-4);
    font-size: 2rem;
    font-weight: var(--fw-reg);
    letter-spacing: -0.704px;
    line-height: 1.13;
}

.auth-header p {
    margin: 0;
    color: var(--text-tertiary);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-standard);
    border-radius: var(--r-xl);
    padding: var(--s-11) var(--s-7);
}

.auth-aside {
    background: var(--bg-card);
    border: 1px solid var(--border-standard);
    border-radius: var(--r-xl);
    padding: var(--s-7);
}

.auth-aside h3 {
    margin: 0 0 var(--s-6);
    font-size: 1rem;
    font-weight: var(--fw-semi);
    color: var(--text-primary);
}

.auth-aside ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.auth-aside li {
    display: flex;
    align-items: baseline;
    gap: var(--s-4);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.auth-aside li::before {
    content: "✓";
    color: var(--success);
    font-weight: var(--fw-semi);
    flex-shrink: 0;
    width: 14px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    margin: var(--s-7) 0;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: var(--fw-med);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-footer-links {
    margin-top: var(--s-7);
    padding-top: var(--s-7);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    font-size: 0.875rem;
}

.auth-footer-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: var(--fw-med);
}

.auth-footer-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.cta-link {
    text-decoration: none;
    display: inline-block;
}

/* Tokenize floating labels + form spacing inside auth pages */
.auth-card .form-floating,
.auth-page .form-floating {
    margin-bottom: var(--s-6);
}

.auth-card .form-floating > label,
.auth-page .form-floating > label {
    color: var(--text-tertiary);
}

.auth-card hr,
.auth-page hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--s-7) 0;
}

/* Password show/hide toggle. The .form-floating wrapper already has
   position:relative; we sit the eye button inside it and pad the input so
   typed characters never collide with the icon. password-toggle.js handles
   the click + class swap via event delegation. */
.form-floating > .form-control.password-toggle-input {
    padding-right: 3rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    z-index: 5;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
    color: var(--text-primary);
    background: var(--bg-hover, rgba(127, 127, 127, 0.12));
    outline: none;
}

.password-toggle-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

.password-toggle-btn .icon-eye-off {
    display: none;
}

.password-toggle-btn.showing .icon-eye {
    display: none;
}

.password-toggle-btn.showing .icon-eye-off {
    display: inline;
}

@media (max-width: 860px) {
    .auth-grid,
    .auth-grid.single {
        grid-template-columns: 1fr;
    }
    .auth-aside {
        order: -1;
    }
}

/* ---------- Error / NotFound page shell ---------- */
.error-page {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--s-15) var(--s-7);
}

.error-cta {
    text-decoration: none;
    display: inline-block;
}

.request-id {
    margin-top: var(--s-7);
    padding: var(--s-4) var(--s-6);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    font-size: 0.8125rem;
    text-align: left;
}

.request-id-label {
    color: var(--text-tertiary);
    font-size: 0.6875rem;
    font-weight: var(--fw-med);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 4px;
}

.request-id code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    word-break: break-all;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Trial-Search-Exposure Phase 3: gated-marker popup. Rendered by
   leaflet-interop.js as raw HTML inside Leaflet's .leaflet-popup-content
   container — Blazor's scoped CSS can't reach it, so the styles live
   here in the global stylesheet. */
.gated-marker-popup {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.gated-marker-popup-cta {
    display: inline-block;
    margin-top: var(--s-2);
    color: var(--accent);
    font-weight: var(--fw-med);
    text-decoration: none;
}

.gated-marker-popup-cta:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
