/* T11 — Persian-first typography + 2026 design bar (RTL, a11y, dark-mode aware,
   reduced-motion respectful). Vazirmatn is loaded via App.razor's CDN link;
   here we set it as the default AND override MudBlazor's per-typography vars
   so components don't fall back to Roboto (which renders Persian inconsistently). */
:root {
    --mud-typography-default-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h1-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h2-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h3-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h4-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h5-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-h6-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-subtitle1-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-subtitle2-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-body1-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-body2-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-button-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-caption-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    --mud-typography-overline-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
}

html, body {
    font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    line-height: 1.85;
    /* iOS Safari needs dvh so the AppBar+chat surface don't jump when the
       address bar collapses; falls back to vh on browsers that don't grok it. */
    min-height: 100vh;
    min-height: 100dvh;
}

/* Belt-and-suspenders: force the Persian face on every MudBlazor surface + inputs. */
.mud-typography, .mud-input, .mud-input-slot, .mud-button-label, input, textarea, button {
    font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif !important;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

/* T11 a11y — visible focus ring for keyboard callers (RTL / dark aware).
   :focus-visible fires only for keyboard focus, not mouse — so the ring
   doesn't add visual noise for pointer users. Uses currentColor so it works
   against both light and dark surfaces without hard-coding either. */
:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 6px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* T11 a11y — skip-to-content link for keyboard users. Hidden by default,
   revealed only on focus (mirror rules for RTL positioning). MainLayout
   emits the target `<main id="main-content">` via `MudMainContent`'s
   generated markup, plus a fallback anchor we add there. */
.khodran-skip-link {
    position: absolute;
    top: -100px;
    right: 8px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--mud-palette-primary, #1C64F2);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.15s ease-in-out;
}
.khodran-skip-link:focus,
.khodran-skip-link:focus-visible {
    top: 8px;
}

/* T11 a11y — tap-target minimum on interactive controls. MudBlazor's small
   icon buttons default to 32×32 which is under the WCAG 2.5.5 44×44 floor
   for touch. We lift only `Size="Size.Medium"`/default; `Size.Small` keeps
   its compact footprint (auth strip, inline chips) where dense layout is
   intentional. `min-height`/`min-width` doesn't shrink oversized targets. */
.mud-icon-button:not(.mud-icon-button-size-small):not(.mud-icon-button-size-large) {
    min-height: 44px;
    min-width: 44px;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0i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0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* T11 — shared «recording» pulse dot. Extracted from Chat.razor so every
   surface (voice recording, live-streaming badges, T20 mechanic voice offer,
   any future long-running micro-state) uses the SAME animation + SAME
   reduced-motion behaviour — one place to change. */
.khodran-pulse-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d32f2f;
    animation: khodran-pulse 1s ease-in-out infinite;
}

@keyframes khodran-pulse {
    0%, 100% { opacity: 1;  transform: scale(1); }
    50%      { opacity: .4; transform: scale(1.25); }
}

/* T18b — mechanic-inbox «جدید» chip flash. Applied for ~1.2s after a fresh
   invitation arrives via the in-process live-events bus, then removed. The
   chip's fresh-chip render is unchanged; the flash is a one-shot outline
   pulse to draw the eye. Same reduced-motion guard as .khodran-pulse-dot. */
.khodran-flash {
    animation: khodran-flash 1.2s ease-in-out 1;
}

@keyframes khodran-flash {
    0%   { box-shadow: 0 0 0 0 var(--mud-palette-success); transform: scale(1); }
    30%  { box-shadow: 0 0 0 8px rgba(76, 175, 80, 0.2); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); transform: scale(1); }
}

/* T11 a11y (WCAG 2.3.3) — reduced-motion respect. Users who set
   `prefers-reduced-motion: reduce` at the OS level MUST NOT see the animated
   pulse dot or MudBlazor's linear-progress ripple. Suppress every animation
   + transition site-wide; the pulse dot falls back to a solid red circle
   (still visible, still red, just no scale/opacity churn). */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .khodran-pulse-dot {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .khodran-flash {
        animation: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
}
