/* =====================================================================================================================
   FastAtPlatform base components (public + admin). Tokens only (fastat-tokens.css); logical properties only, so the Arabic
   RTL layout needs no extra rules. Focus: 2 px brand-orange ring with 2 px offset on every interactive element.
   ===================================================================================================================== */

/* ---- Document ------------------------------------------------------------------------------------------------------ */
body.fast {
    background-color: var(--fast-bg);
    color: var(--fast-text);
    font-family: var(--fast-font-body);
    font-size: 1rem;
    line-height: 1.625;            /* 16 / 26 */
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}
html[lang="ar"] body.fast {
    font-size: 1.0625rem;          /* Arabic body +1 px (17 / 30) */
    line-height: 1.8;
}

.fast h1, .fast h2, .fast h3, .fast h4, .fast .fast-display {
    font-family: var(--fast-font-heading);
    color: var(--fast-text);
    font-weight: 700;
    letter-spacing: -0.01em;
}
html[lang="ar"] .fast h1, html[lang="ar"] .fast h2, html[lang="ar"] .fast h3, html[lang="ar"] .fast h4, html[lang="ar"] .fast .fast-display {
    letter-spacing: 0;
    line-height: 1.35;
}
.fast .fast-display { font-size: clamp(2rem, 1.2rem + 3.2vw, 3rem); line-height: 1.08; }
.fast h1, .fast .fast-h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem); line-height: 1.22; }
.fast h2, .fast .fast-h2 { font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.75rem); line-height: 1.28; font-weight: 700; }
.fast h3, .fast .fast-h3 { font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem); line-height: 1.4; font-weight: 600; }
.fast .fast-lead { font-size: 1.125rem; line-height: 1.6; color: var(--fast-text-muted); }
.fast .fast-small { font-size: 0.875rem; line-height: 1.57; }
.fast .fast-muted { color: var(--fast-text-muted); }
.fast .fast-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    line-height: 1.33;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fast-teal-text);
    margin-block-end: var(--fast-s3);
}
html[lang="ar"] .fast .fast-eyebrow { letter-spacing: 0; text-transform: none; font-size: 0.875rem; }

.fast a:not(.btn):not(.dropdown-item) { color: var(--fast-primary); text-underline-offset: 0.18em; }
.fast a:not(.btn):not(.dropdown-item):hover { color: var(--fast-primary-hover); }

/* Technical values (codes, URLs, phone numbers, emails) inside any text direction. */
.fast .fast-ltr, .fast bdi.fast-ltr { direction: ltr; unicode-bidi: isolate; }
.fast .fast-mono { font-family: var(--fast-font-mono); font-size: 0.9em; }
.fast .fast-num { font-variant-numeric: tabular-nums; }
.fast code { color: inherit; font-family: var(--fast-font-mono); font-size: 0.9em; }

/* ---- Focus (visible, consistent, never removed) ------------------------------------------------------------------- */
.fast :focus-visible {
    outline: 2px solid var(--fast-focus);
    outline-offset: 2px;
    box-shadow: none;
}
.fast .btn:focus-visible, .fast .form-control:focus-visible, .fast .form-select:focus-visible, .fast .form-check-input:focus-visible {
    outline: 2px solid var(--fast-focus);
    outline-offset: 2px;
    box-shadow: none;
}

/* Skip link */
.fast .fast-skip-link:focus {
    position: fixed;
    inset-block-start: var(--fast-s3);
    inset-inline-start: var(--fast-s3);
    z-index: 2000;
    padding: var(--fast-s3) var(--fast-s4);
    background: var(--fast-surface);
    color: var(--fast-text);
    border: 2px solid var(--fast-focus);
    border-radius: var(--fast-radius-sm);
}

/* ---- Buttons ------------------------------------------------------------------------------------------------------ */
.fast .btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--fast-radius);
    --bs-btn-padding-y: 0.625rem;
    --bs-btn-padding-x: 1.125rem;
    min-height: var(--fast-touch);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fast-s2);
    transition: background-color var(--fast-duration) var(--fast-ease), border-color var(--fast-duration) var(--fast-ease), color var(--fast-duration) var(--fast-ease);
}
.fast .btn-sm { min-height: 36px; --bs-btn-padding-y: 0.375rem; --bs-btn-padding-x: 0.75rem; --bs-btn-border-radius: var(--fast-radius-sm); }
.fast .btn-primary {
    --bs-btn-bg: var(--fast-primary);
    --bs-btn-border-color: var(--fast-primary);
    --bs-btn-color: var(--fast-on-primary);
    --bs-btn-hover-bg: var(--fast-primary-hover);
    --bs-btn-hover-border-color: var(--fast-primary-hover);
    --bs-btn-hover-color: var(--fast-on-primary);
    --bs-btn-active-bg: var(--fast-primary-hover);
    --bs-btn-active-border-color: var(--fast-primary-hover);
    --bs-btn-active-color: var(--fast-on-primary);
    --bs-btn-disabled-bg: var(--fast-primary);
    --bs-btn-disabled-border-color: var(--fast-primary);
    --bs-btn-disabled-color: var(--fast-on-primary);
}
.fast .btn-outline-primary {
    --bs-btn-color: var(--fast-primary);
    --bs-btn-border-color: var(--fast-primary);
    --bs-btn-hover-bg: var(--fast-primary);
    --bs-btn-hover-border-color: var(--fast-primary);
    --bs-btn-hover-color: var(--fast-on-primary);
    --bs-btn-active-bg: var(--fast-primary-hover);
    --bs-btn-active-color: var(--fast-on-primary);
    --bs-btn-disabled-color: var(--fast-primary);
    --bs-btn-disabled-border-color: var(--fast-primary);
}
.fast .btn-outline-secondary {
    --bs-btn-color: var(--fast-text);
    --bs-btn-border-color: var(--fast-border-strong);
    --bs-btn-hover-bg: var(--fast-surface-2);
    --bs-btn-hover-border-color: var(--fast-border-strong);
    --bs-btn-hover-color: var(--fast-text);
    --bs-btn-active-bg: var(--fast-surface-3);
    --bs-btn-active-color: var(--fast-text);
}
/* The ONE conversion CTA per view: brand orange with dark ink (6.67:1). */
.fast .btn-cta {
    --bs-btn-bg: var(--fast-action-orange-bg);
    --bs-btn-border-color: var(--fast-action-orange-bg);
    --bs-btn-color: var(--fast-on-orange);
    --bs-btn-hover-bg: var(--fast-action-orange-hover);
    --bs-btn-hover-border-color: var(--fast-action-orange-hover);
    --bs-btn-hover-color: var(--fast-on-orange);
    --bs-btn-active-bg: var(--fast-action-orange-hover);
    --bs-btn-active-color: var(--fast-on-orange);
    --bs-btn-disabled-bg: var(--fast-action-orange-bg);
    --bs-btn-disabled-color: var(--fast-on-orange);
}
.fast .btn-ghost {
    --bs-btn-color: var(--fast-primary);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--fast-primary-tint);
    --bs-btn-hover-color: var(--fast-primary-hover);
    --bs-btn-active-bg: var(--fast-primary-tint);
}
.fast .btn-danger {
    --bs-btn-bg: var(--fast-danger);
    --bs-btn-border-color: var(--fast-danger);
    --bs-btn-color: #FFFFFF;
    --bs-btn-hover-bg: #8F1C13;
    --bs-btn-hover-border-color: #8F1C13;
    --bs-btn-hover-color: #FFFFFF;
}
html[data-theme="dark"] .fast .btn-danger { --bs-btn-color: #07182A; --bs-btn-hover-bg: #FFB3AC; --bs-btn-hover-border-color: #FFB3AC; --bs-btn-hover-color: #07182A; }
.fast .btn-icon { inline-size: var(--fast-touch); min-inline-size: var(--fast-touch); padding: 0; }
.fast .btn[aria-busy="true"] { cursor: progress; }

/* Directional glyphs mirror in RTL; logos, play icons, check marks and brand icons never do. */
[dir="rtl"] .fast .fa-flip-rtl, [dir="rtl"] .fa-flip-rtl { transform: scaleX(-1); }

/* ---- Forms -------------------------------------------------------------------------------------------------------- */
.fast .form-label { font-weight: 600; font-size: 0.9375rem; margin-block-end: var(--fast-s2); color: var(--fast-text); }
.fast .form-control, .fast .form-select {
    min-height: var(--fast-touch);
    font-size: 1rem;              /* ≥ 16 px: no iOS zoom on focus */
    color: var(--fast-text);
    background-color: var(--fast-surface);
    border: 1px solid var(--fast-border-strong);
    border-radius: var(--fast-radius-sm);
}
.fast .form-control::placeholder { color: var(--fast-text-muted); opacity: 1; }
.fast .form-control:focus, .fast .form-select:focus { border-color: var(--fast-primary); box-shadow: none; }
.fast .form-text { color: var(--fast-text-muted); font-size: 0.875rem; }
.fast .form-check-input { border-color: var(--fast-border-strong); }
.fast .form-check-input:checked { background-color: var(--fast-primary); border-color: var(--fast-primary); }
.fast .is-invalid, .fast .form-control.is-invalid, .fast .form-select.is-invalid { border-color: var(--fast-danger); }
.fast .invalid-feedback, .fast .fast-field-error {
    display: flex;
    gap: var(--fast-s2);
    align-items: flex-start;
    color: var(--fast-danger);
    font-size: 0.875rem;
    margin-block-start: var(--fast-s2);
}
.fast .fast-field-error::before { content: "\f06a"; font-family: "Font Awesome 6 Pro"; font-weight: 900; }
.fast .fast-required { color: var(--fast-danger); margin-inline-start: 2px; }
.fast .fast-validation-summary {
    border: 1px solid var(--fast-danger);
    background: var(--fast-danger-tint);
    border-radius: var(--fast-radius);
    padding: var(--fast-s4);
    color: var(--fast-text);
}
.fast .fast-honeypot { position: absolute !important; inset-inline-start: -10000px; inline-size: 1px; block-size: 1px; overflow: hidden; }

/* ---- Cards, chips, badges ------------------------------------------------------------------------------------------ */
.fast .fast-card {
    background: var(--fast-surface);
    border: 1px solid var(--fast-border);
    border-radius: var(--fast-radius);
    padding: var(--fast-s5);
}
@media (max-width: 575.98px) { .fast .fast-card { padding: var(--fast-s4); } }
.fast .fast-panel { background: var(--fast-surface); border: 1px solid var(--fast-border); border-radius: var(--fast-radius-lg); }

.fast .fast-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    white-space: nowrap;
}
.fast .fast-badge--success { color: var(--fast-success-strong); background: var(--fast-success-tint); border-color: currentColor; }
.fast .fast-badge--warning { color: var(--fast-warning-strong); background: var(--fast-warning-tint); border-color: currentColor; }
.fast .fast-badge--danger { color: var(--fast-danger-strong); background: var(--fast-danger-tint); border-color: currentColor; }
.fast .fast-badge--info { color: var(--fast-primary); background: var(--fast-primary-tint); border-color: currentColor; }
html[data-theme="dark"] .fast .fast-badge--info { color: var(--fast-primary-hover); }   /* P12: about 4.1:1 -> 5.7:1 on the dark card surface */
.fast .fast-badge--neutral { color: var(--fast-text-muted); background: var(--fast-surface-2); border-color: var(--fast-border); }
.fast .fast-badge--teal { color: var(--fast-teal-strong); background: var(--fast-teal-tint); border-color: currentColor; }

.fast .fast-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--fast-s2);
    min-height: 36px;
    padding: 0 var(--fast-s3);
    border-radius: 999px;
    border: 1px solid var(--fast-border-strong);
    background: var(--fast-surface);
    color: var(--fast-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}
.fast .fast-chip:hover { background: var(--fast-surface-2); color: var(--fast-text); }
.fast .fast-chip[aria-pressed="true"], .fast .fast-chip.is-selected {
    background: var(--fast-primary);
    border-color: var(--fast-primary);
    color: var(--fast-on-primary);
}

/* ---- Overlays: modal, toast, dropdown ------------------------------------------------------------------------------ */
.fast .modal-content {
    background: var(--fast-surface);
    color: var(--fast-text);
    border: 1px solid var(--fast-border);
    border-radius: var(--fast-radius-lg);
    box-shadow: var(--fast-shadow-overlay);
}
.fast .modal-header, .fast .modal-footer { border-color: var(--fast-border); }
.fast .modal-backdrop.show { opacity: 1; background: var(--fast-scrim); }
.fast .dropdown-menu {
    background: var(--fast-surface);
    color: var(--fast-text);
    border: 1px solid var(--fast-border);
    border-radius: var(--fast-radius);
    box-shadow: var(--fast-shadow-overlay);
}
.fast .dropdown-item { color: var(--fast-text); min-height: 40px; display: flex; align-items: center; gap: var(--fast-s2); }
.fast .dropdown-item:hover, .fast .dropdown-item:focus { background: var(--fast-surface-2); color: var(--fast-text); }
.fast .dropdown-item.active, .fast .dropdown-item[aria-checked="true"] { background: var(--fast-primary-tint); color: var(--fast-text); font-weight: 600; }

.fast-toast-region {
    position: fixed;
    inset-block-end: var(--fast-s4);
    inset-inline-end: var(--fast-s4);
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: var(--fast-s2);
    max-inline-size: min(420px, calc(100vw - 32px));
}
.fast .fast-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--fast-s3);
    padding: var(--fast-s3) var(--fast-s4);
    background: var(--fast-surface);
    color: var(--fast-text);
    border: 1px solid var(--fast-border);
    border-inline-start: 4px solid var(--fast-primary);
    border-radius: var(--fast-radius);
    box-shadow: var(--fast-shadow-overlay);
}
.fast .fast-toast--success { border-inline-start-color: var(--fast-success); }
.fast .fast-toast--error { border-inline-start-color: var(--fast-danger); }
.fast .fast-toast--info { border-inline-start-color: var(--fast-primary); }
.fast .fast-toast__icon { line-height: 1.6; }
.fast .fast-toast--success .fast-toast__icon { color: var(--fast-success); }
.fast .fast-toast--error .fast-toast__icon { color: var(--fast-danger); }
.fast .fast-toast__body { flex: 1 1 auto; min-inline-size: 0; overflow-wrap: anywhere; }
.fast .fast-toast__actions { display: flex; gap: var(--fast-s2); }

/* ---- States: map the RF-UI-BASE panels onto Fast-AT surfaces ------------------------------------------------------- */
.fast .rf-state { border-radius: var(--fast-radius); }
.fast .rf-state__icon { color: var(--fast-primary); }
.fast .rf-state--error .rf-state__icon { color: var(--fast-danger); }
.fast [aria-busy="true"] { cursor: progress; }

/* ---- Reduced motion ------------------------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .fast *, .fast *::before, .fast *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
