/*
 * Alertes sanitaires
 *
 * Deux blocs : le tableau de la page dédiée (exigence 10.18) et le bandeau des
 * alertes en cours affiché en page d'accueil.
 *
 * Le tableau compte onze colonnes. Plutôt que de les masquer sur petit écran,
 * ce qui reviendrait à priver le patient d'informations dont il a besoin pour
 * identifier sa boîte, il bascule en fiches empilées : chaque cellule reprend
 * son intitulé de colonne par l'attribut data-libelle.
 */

.pdc-alertes {
    margin: 2rem 0;
}

.pdc-alertes__vide {
    padding: 1.25rem 1.5rem;
    background: #f4f6f8;
    border: 1px solid #dde3e9;
    border-radius: 4px;
    color: #4a5563;
}

/* Le conteneur défilant évite que le tableau ne pousse la page en largeur. */
.pdc-alertes__defilement {
    overflow-x: auto;
    border: 1px solid #dde2e8;
    border-radius: 6px;
}

.pdc-alertes__defilement:focus-visible {
    outline: 2px solid #0b6b58;
    outline-offset: 2px;
}

.pdc-alertes__tableau {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.45;
}

.pdc-alertes__legende {
    padding: 0.75rem 1rem;
    text-align: left;
    color: #4a5563;
    font-size: 0.85rem;
}

.pdc-alertes__tableau th {
    position: sticky;
    top: 0;
    padding: 0.75rem 0.85rem;
    background: #eef1f4;
    border-bottom: 2px solid #c7ced6;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.pdc-alertes__tableau td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #e6eaee;
    vertical-align: top;
}

.pdc-alertes__ligne:nth-child(even) td {
    background: #fafbfc;
}

/* Une alerte clôturée reste consultable, mais ne doit plus attirer l'oeil. */
.pdc-alertes__ligne--cloturee td {
    color: #7b8794;
}

.pdc-alertes__etat {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7b8794;
}

.pdc-alertes__date,
.pdc-alertes__code {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pdc-alertes__designation {
    min-width: 200px;
    font-weight: 600;
}

.pdc-alertes__type {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef1f4;
    color: #3c4653;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Le rappel et le retrait demandent une action du patient : ils se voient. */
.pdc-alertes__type--rappel_lot,
.pdc-alertes__type--retrait {
    background: #fdecec;
    color: #a4262c;
}

.pdc-alertes__type--restriction,
.pdc-alertes__type--mise_en_garde {
    background: #fdf3e2;
    color: #8a5300;
}

.pdc-alertes__ligne--cloturee .pdc-alertes__type {
    background: #eef1f4;
    color: #7b8794;
}

.pdc-alertes__contact {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #4a5563;
}

@media (max-width: 900px) {
    .pdc-alertes__defilement {
        overflow-x: visible;
        border: 0;
    }

    .pdc-alertes__tableau,
    .pdc-alertes__tableau tbody,
    .pdc-alertes__tableau tr,
    .pdc-alertes__tableau td {
        display: block;
        width: auto;
        min-width: 0;
    }

    .pdc-alertes__tableau thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .pdc-alertes__ligne {
        margin-bottom: 1rem;
        border: 1px solid #dde2e8;
        border-radius: 6px;
        overflow: hidden;
    }

    .pdc-alertes__tableau td,
    .pdc-alertes__ligne:nth-child(even) td {
        background: #fff;
        border-bottom: 1px solid #f0f3f6;
    }

    .pdc-alertes__tableau td:last-child {
        border-bottom: 0;
    }

    .pdc-alertes__tableau td::before {
        content: attr(data-libelle);
        display: block;
        margin-bottom: 0.15rem;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #7b8794;
    }

    /* Une cellule vide sans son intitulé ne dit rien : on la retire. */
    .pdc-alertes__tableau td:empty {
        display: none;
    }
}

/*
 * Bandeau de la page d'accueil
 *
 * Une seule ligne, discrète. L'information tient en trois éléments : qu'il y a
 * une alerte, sur quoi elle porte, et où lire la suite. Le détail appartient à
 * la page dédiée ; répété ici, il ferait un pavé que personne ne lit.
 */

.pdc-alertes-accueil {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin: 1rem auto;
    padding: 0.6rem 0.9rem;
    background: #fdf6ec;
    border: 1px solid #eddcc0;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #6b5330;
}

.pdc-alertes-accueil i,
.pdc-alertes-accueil svg {
    flex: none;
    width: 1em;
    height: 1em;
    color: #c47f17;
}

.pdc-alertes-accueil__intitule {
    font-weight: 600;
}

.pdc-alertes-accueil__intitule::after {
    content: " :";
}

.pdc-alertes-accueil__objets {
    flex: 1 1 auto;
    min-width: 0;
}

.pdc-alertes-accueil__lien {
    flex: none;
    margin-left: auto;
    white-space: nowrap;
}


/*
 * Bandeau d'accueil sur telephone.
 *
 * Il s'enroulait sur deux lignes : « Voir le detail » porte margin-left auto et
 * ne se coupe pas, il etait donc rejete seul sous une liste de noms elle-meme
 * tronquee au hasard de la largeur. Deux lignes accidentelles se lisent comme
 * une erreur de mise en page.
 *
 * Sur une seule ligne, la liste des produits se tronque proprement et le lien
 * se reduit a un chevron : l'information tient, et le bandeau reste un bandeau
 * plutot qu'un pave.
 */
@media (max-width: 640px) {
    .pdc-alertes-accueil {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.4rem;
        padding: 0.55rem 0.7rem;
        font-size: 0.82rem;
    }

    .pdc-alertes-accueil__intitule {
        flex: none;
    }

    /* Le deux-points disparait : la troncature qui suit tient lieu de liaison. */
    .pdc-alertes-accueil__intitule::after {
        content: "";
    }

    .pdc-alertes-accueil__objets {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pdc-alertes-accueil__lien {
        overflow: hidden;
        width: 1rem;
        text-indent: -99em;
    }

    .pdc-alertes-accueil__lien::after {
        content: "\203A";
        float: left;
        width: 1rem;
        font-size: 1.15rem;
        line-height: 1;
        text-indent: 0;
        text-align: right;
    }
}
