/* ==========================================================================
   QuoteServer base — typography, links, focus, scrollbars, motion
   ========================================================================== */

html, body {
    font-family: var(--qs-font);
    background-color: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-size: .875rem;
    line-height: 1.5;
    margin: 0;
}

/* Raw headings follow the same scale as MudText */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--qs-font);
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: .875rem; }

/* Headings receive programmatic focus on navigation (FocusOnNavigate): no visible ring */
h1:focus, h1:focus-visible,
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible {
    outline: none;
    box-shadow: none;
}

a {
    color: var(--mud-palette-secondary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--mud-palette-primary);
}

.qs-dark a:not(.mud-nav-link):not(.mud-button-root):hover {
    color: var(--mud-palette-text-primary);
}

::selection {
    background: rgba(180, 250, 50, 0.45);
    color: #002C36;
}

/* Numbers line up in financial tables */
table, .mud-table, .mud-data-grid, .qs-num {
    font-variant-numeric: tabular-nums;
}

code, kbd, pre, samp, .qs-mono {
    font-family: var(--qs-font-mono);
    font-size: .8125rem;
}

/* Inline identifiers (ISIN, tokens, endpoints) */
code {
    padding: 1px 6px;
    border-radius: var(--qs-radius-sm);
    background-color: var(--qs-tint-brand);
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

/* Visually hidden, still announced by screen readers */
.qs-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard focus: visible ring only for keyboard users */
:focus-visible {
    outline: none;
    box-shadow: var(--qs-focus-ring);
    border-radius: var(--qs-radius-sm);
}

/* Validation (Blazor EditForm) */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mud-palette-success);
}

.invalid {
    outline: 1px solid var(--mud-palette-error);
}

.validation-message {
    color: var(--mud-palette-error);
    font-size: .75rem;
    margin-top: var(--qs-space-1);
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-lines-inputs) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-lines-inputs);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

/* Blazor error UI */
#blazor-error-ui {
    background: #FFF4E5;
    color: #5C2E00;
    border-top: 1px solid #F0C28A;
    bottom: 0;
    box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.10);
    display: none;
    left: 0;
    padding: 12px 24px;
    position: fixed;
    width: 100%;
    z-index: 2000;
    font-size: .875rem;
}

#blazor-error-ui .reload {
    font-weight: 600;
    margin-left: 8px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 10px;
}

.blazor-error-boundary {
    background: var(--qs-tint-error);
    border: 1px solid var(--mud-palette-error);
    border-left-width: 4px;
    border-radius: var(--qs-radius);
    padding: 12px 16px;
    color: var(--mud-palette-error);
}

.blazor-error-boundary::after {
    content: "Se ha producido un error al mostrar este bloque.";
}

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