/*
 * EzLibrAPI : feuille de style de l'application (au-dessus de Bootstrap 5).
 * Plus aucun style dans les templates : tout est ici.
 *
 * Sommaire
 *   1. Variables et polices
 *   2. Base
 *   3. Navigation et pied de page
 *   4. Accueil (cartes des outils)
 *   5. Pages outil : en-tête, formulaire, liens
 *   6. Résultats (notices, rappel de recherche, aperçu)
 *   7. Statistiques
 *   8. EzPCPP : sélecteur de colonnes et autocomplétion
 *   9. Suivi d'un traitement asynchrone
 *  10. Petits écrans
 */

/* 1. Variables et polices ------------------------------------------------ */

@font-face {
    font-family: "PaytoneAPI";
    src: url("../fonts/PaytoneOne-Regular.1f7652ec6b78.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: "LatoAPI";
    src: url("../fonts/Lato-Regular.3b9b99039cc0.ttf") format("truetype");
    font-display: swap;
}

:root {
    --app-brand: #283a90;
    --app-brand-light: #516ae0;
    --app-accent: #ffa000;
    --app-border: #dee2e6;
    --app-muted-bg: #f8fafc;
    --app-font-title: "PaytoneAPI", "Trebuchet MS", sans-serif;

    --bs-body-font-family: "LatoAPI", "Trebuchet MS", sans-serif;
    --bs-link-color-rgb: 40, 58, 144;
    --bs-link-hover-color-rgb: 81, 106, 224;
}

/* 2. Base ---------------------------------------------------------------- */

h1, h2, h3,
.app-title {
    font-family: var(--app-font-title);
    font-weight: 400;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

.text-justify { text-align: justify; }

/* 3. Navigation et pied de page ------------------------------------------ */

.app-brand {
    font-family: var(--app-font-title);
}

.navbar .nav-link {
    font-size: 1.15rem;
}

.app-footer {
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--app-border);
    color: #6c757d;
    font-size: 0.875rem;
    text-align: center;
}

/* 4. Accueil (cartes des outils) ----------------------------------------- */

.home-title {
    margin: 1rem 0 0;
}

.tool-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover,
.tool-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--app-border);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
    color: inherit;
}

.tool-card img {
    flex-shrink: 0;
}

.tool-card h2 {
    margin: 0 0 0.25rem;
}

.tool-card p {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .tool-card { transition: none; }
    .tool-card:hover { transform: none; }
}

/* 5. Pages outil : en-tête, formulaire, liens ---------------------------- */

.tool-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem 0 2rem;
}

.tool-header__icon {
    flex-shrink: 0;
    object-fit: contain;
}

.tool-header__title {
    margin: 0;
    font-size: 2rem;
}

.tool-header__title a {
    color: inherit;
    text-decoration: none;
}

.tool-header__subtitle {
    margin: 0;
    color: #495057;
}

.section-title {
    padding-bottom: 0.35rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-brand);
    font-size: 1.35rem;
}

.search-card {
    padding: 1.5rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #fff;
}

.tool-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.tool-about {
    margin-top: 3rem;
}

/* 6. Résultats ----------------------------------------------------------- */

.query-summary {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: var(--app-muted-bg);
}

.query-summary .section-title {
    border-bottom: 0;
    margin-bottom: 0.5rem;
}

.query-summary__list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}

.query-summary__list dt {
    font-style: italic;
}

.query-summary__list dd {
    margin: 0;
}

/* Tableau des notices (une ligne par catalogue interrogé) */
.records {
    line-height: 1.4;
}

.records__source {
    width: 10rem;
    font-family: var(--app-font-title);
    font-size: 1.3rem;
}

.records__codes {
    width: 18rem;
}

.record {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.15rem 0.5rem;
    margin: 0;
}

.record dt {
    font-weight: 700;
}

.record dd {
    margin: 0;
}

.record__author {
    color: #8b0000;
    font-weight: 700;
}

.record__title {
    font-style: italic;
}

.record__secondary,
.record dt.record__secondary {
    color: #6c757d;
    font-size: 0.875rem;
}

.record__code {
    color: var(--app-accent);
    font-weight: 700;
}

/* Aperçu du fichier importé */
.preview-table {
    min-width: 60rem;
}

.preview-table thead th {
    border-bottom: 3px double #000;
}

/* 7. Statistiques -------------------------------------------------------- */

.ez-stats {
    display: grid;
    gap: 0.75rem;
    margin: 0.75rem 0 1rem;
}

.ez-stat {
    padding: 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: var(--app-muted-bg);
}

.ez-stat-label {
    margin-bottom: 0.3rem;
    color: #475569;
    font-size: 0.8rem;
}

.ez-stat-value {
    color: #0f172a;
    font-size: 1.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ez-stats-title {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.ez-stats-note {
    color: #6c757d;
    font-size: 0.75rem;
}

/* Barre de progression plus haute (traitements longs) */
.progress--large {
    height: 1.75rem;
}

/* 8. EzPCPP : sélecteur de colonnes et autocomplétion -------------------- */

.ui-autocomplete {
    max-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
}

.output-columns div.tree-multiselect {
    border-width: 1px;
    border-radius: 0.5rem !important;
}

.output-columns div.selections {
    display: table-cell !important;
    height: 100% !important;
    border: none !important;
    border-right: 1px solid #d8d8d8 !important;
}

.output-columns div.selections > div.auxiliary {
    color: #ececec;
}

.output-columns div.selected.ui-sortable {
    display: table-cell !important;
}

.output-columns .select-all-container {
    color: #777;
    font-weight: 700;
}

/* 9. Suivi d'un traitement asynchrone (EzPPNfinder) ---------------------- */

.job-panel {
    max-width: 50rem;
    margin: 1.5rem auto 0;
}

/* 10. Petits écrans ------------------------------------------------------ */

@media (max-width: 575.98px) {
    .tool-header__icon {
        width: 56px;
        height: 56px;
    }

    .tool-header__title {
        font-size: 1.5rem;
    }

    .text-justify {
        text-align: left;
    }
}

/* 11. Barre de navigation fixe : les ancres ne passent pas dessous */
html {
    scroll-padding-top: 4.5rem;
}
