/* The Santos identity on top of Filament's theme. Plain CSS, no Tailwind and no
 * build: `php artisan filament:assets` publishes it to public/css/app/santos.css
 * and App\Filament\Branding serves it from the STYLES_AFTER render hook.
 *
 * That hook is not a whim: @filamentStyles is printed BEFORE Filament's own
 * theme, so a stylesheet registered the normal way would lose the cascade tie.
 * Every block is anchored on `html.fi` (specificity 0,1,1) instead of `:root`
 * (0,1,0), which is how Filament declares its variables, to win the tie
 * whatever happens with the load order.
 *
 * Any rule pointing at a .fi-* class may stop matching on a Filament upgrade;
 * the failure would always be cosmetic, never functional.
 *
 * The colours are NOT here: Filament generates them from the palette in
 * App\Filament\Branding.
 */

/* Open Sans, the legacy's font. It is served from public/fonts/santos so that
 * an authenticated panel does not ask a third party for it on every load.
 * Files and unicode-range from @fontsource-variable/open-sans 5.3.0 (OFL-1.1);
 * the paths are relative because the stylesheet is served from /css/app/. */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('../../fonts/santos/open-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
        U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('../../fonts/santos/open-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
        U+A720-A7FF;
}

/* The legacy has square corners (border-radius: 0 written by hand on buttons,
 * modals and inputs), but that reads dated today: instead of squaring
 * everything, Filament's scale (.25/.375/.5/.75rem) is tightened to a bit over
 * half. The result is a discreet rounding, more restrained than a freshly
 * installed panel and without the nineties-form feel. All of Filament's radii
 * go through these four variables, so the rule reaches buttons, fields,
 * sections, modals, badges, dropdowns, menu items and the login card. */
html.fi {
    --radius-sm: 0.125rem;
    --radius-md: 0.25rem;
    --radius-lg: 0.375rem;
    --radius-xl: 0.5rem;
}

/* Table headers like the legacy's (12px, uppercase and normal weight over the
 * secondary grey); Filament ships them at 14px semibold, nearly black. It is
 * the most recognisable thing about its listings. A sortable column wraps its
 * label in a button that resets text-transform, so it has to be repeated. */
html.fi .fi-ta-header-cell,
html.fi .fi-ta-header-cell-sort-btn {
    font-size: 0.75rem;
    font-weight: var(--font-weight-normal);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-500);
}

/* Row hover on the surface grey (#ebebeb), like the legacy. Filament uses
 * --gray-50, which is barely distinguishable from the page background. */
html.fi .fi-ta-row.fi-clickable:hover {
    background-color: var(--gray-100);
}

/* Login and password recovery over the corporate grey: the white card and the
 * logo above the heading are already Filament's doing. */
html.fi .fi-simple-layout {
    background-color: var(--gray-100);
}

/* Language switcher of the login screen: a discreet row of links under the
 * form, in the secondary grey, with the current language in black. */
html.fi .santos-locale-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1rem;
    font-size: 0.75rem;
}

html.fi .santos-locale-switcher a {
    color: var(--gray-500);
}

html.fi .santos-locale-switcher a:hover {
    color: var(--gray-950);
    text-decoration: underline;
}

html.fi .santos-locale-switcher a[aria-current] {
    color: var(--gray-950);
    font-weight: var(--font-weight-medium);
}

/* The category tree of the portal. Each group (the loose documents and every
 * subcategory) writes `data-view` on its wrapper — Alpine flips it from the
 * list/grid switch, starting on the container's `grid_view` — and the layout
 * of the whole block hangs off it. Doing it in CSS instead of with two Blade
 * branches keeps ONE set of checkboxes inside the form, which is what the ZIP
 * submits. */
html.fi .santos-tree-files {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 1rem;
}

html.fi .santos-tree-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
}

html.fi .santos-tree-file-spacer {
    width: 1.25rem;
    flex-shrink: 0;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file-spacer {
    display: none;
}

html.fi .santos-tree-file-icon {
    height: 1.5rem;
    width: 1.5rem;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file-icon {
    height: 2.5rem;
    width: 2.5rem;
}

/* The thumbnail takes the icon's place when the document has one. `contain`
 * because the source keeps its aspect ratio (the longest side is what the
 * generator caps), and in the grid it is the whole point of the mosaic, so it
 * gets the width of the card instead of an icon-sized box. */
html.fi .santos-tree-file-thumbnail {
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
    object-fit: contain;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file-thumbnail {
    height: 7rem;
    width: 100%;
}

/* Back office record: the thumbnail of each variant above its uploader. */
html.fi .santos-version-thumbnail {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

html.fi .santos-version-thumbnail-image {
    max-height: 10rem;
    max-width: 100%;
    object-fit: contain;
}

html.fi .santos-version-thumbnail-icon {
    height: 2.5rem;
    width: 2.5rem;
    color: var(--gray-400);
}

html.fi .santos-version-thumbnail-pending {
    font-size: 0.875rem;
    color: var(--gray-500);
}

html.fi .santos-tree-file-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file-text {
    align-items: center;
}

html.fi .santos-tree-file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

html.fi .santos-tree-group[data-view='grid'] .santos-tree-file-meta {
    justify-content: center;
}

/* The quick view button of a document: it sits among the metadata, next to the
 * download link, and has to read like it and not like a form button — it lives
 * inside the ZIP form. */
html.fi .santos-tree-file-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

/* Select all + list/grid switch, in the section header. They sit in
 * `.fi-section-header-after-ctn`, the one place Filament's header does not
 * read a click as «collapse this section». */
html.fi .santos-tree-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

html.fi .santos-tree-select-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

html.fi .santos-tree-view {
    display: flex;
    align-items: center;
}

/* The active mode is the opaque one; there is no toggle-group component in
 * Filament and a pressed state made of colours would fight the section header. */
html.fi .santos-tree-view-list,
html.fi .santos-tree-view-grid {
    opacity: 0.35;
}

html.fi .santos-tree-group[data-view='list'] .santos-tree-view-list,
html.fi .santos-tree-group[data-view='grid'] .santos-tree-view-grid {
    opacity: 1;
}
