/* Portail des applications EAF — grille de tuiles et carrousel */

.page-portail .contenu { max-width: 1400px; display: flex; flex-direction: column; justify-content: center; }

.portail-vide { font-size: 22px; margin: 80px 0; }

/* ---------- Carrousel ---------- */
.carrousel {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    grid-template-areas: "prec fenetre suiv" ". points .";
    align-items: center;
    gap: 16px 12px;
}
.carrousel[data-pages="1"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "fenetre"; }

.carrousel-fenetre { grid-area: fenetre; overflow: hidden; padding: 6px; margin: -6px; }

/* Les pages sont côte à côte ; le script décale la piste d'une page à l'autre */
.carrousel-piste { display: flex; transition: transform .35s ease; }
.page-tuiles { flex: 0 0 100%; padding: 0 6px; }

/* ---------- Tuiles : 4 × 2 ---------- */
.page-tuiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(170px, 28vh, 260px);
    gap: 24px;
    align-content: start;
}

.tuile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 28px 16px 20px;
    overflow: hidden;
    background: var(--blanc);
    border: 1px solid #E8E8E8;
    border-radius: 12px;
    color: var(--gris-texte);
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    transition: box-shadow .25s ease, transform .25s ease;
}
/* Bandeau de la couleur de l'application, qui s'épaissit au survol */
.tuile::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    background: var(--c, var(--rouge));
    transition: height .25s ease;
}
.tuile:hover {
    box-shadow: 0 10px 22px rgba(0, 0, 0, .10);
    transform: translateY(-4px);
}
.tuile:hover::before { height: 12px; }
.tuile:focus-visible { outline: 3px solid var(--c, var(--rouge)); outline-offset: 3px; }
.tuile:active { transform: none; }

.tuile-icone { color: var(--c, var(--rouge)); display: flex; }
.tuile-icone .icone { width: clamp(56px, 8vh, 84px); height: clamp(56px, 8vh, 84px); stroke-width: 1.6; }

.tuile-nom {
    font-size: 19px;
    font-weight: bold;
    text-align: center;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.badge-admin {
    position: absolute;
    top: 18px;
    right: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--gris-texte);
    color: var(--blanc);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* ---------- Flèches et points ---------- */
.carrousel-fleche {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: 1px solid var(--gris-bord);
    border-radius: 50%;
    background: var(--blanc);
    color: var(--rouge);
    cursor: pointer;
}
.carrousel-precedent { grid-area: prec; }
.carrousel-suivant { grid-area: suiv; }
.carrousel-fleche .icone { width: 30px; height: 30px; }
.carrousel-fleche:hover:not(:disabled) { background: var(--rouge); color: var(--blanc); border-color: var(--rouge); }
.carrousel-fleche:focus-visible { outline: 3px solid var(--rouge); outline-offset: 2px; }
.carrousel-fleche:disabled { opacity: .3; cursor: default; }

.carrousel-points { grid-area: points; display: flex; justify-content: center; gap: 4px; }
.carrousel-point {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carrousel-point::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gris-bord);
    transition: background .15s, transform .15s;
}
.carrousel-point:hover::before { background: var(--gris-moyen); }
.carrousel-point[aria-current="true"]::before { background: var(--rouge); transform: scale(1.2); }
.carrousel-point:focus-visible { outline: 2px solid var(--rouge); border-radius: 50%; }

/* ---------- Message de lancement d'un programme Windows ---------- */
.toast-lancement {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 10;
    max-width: min(560px, calc(100% - 32px));
    padding: 14px 22px;
    border-radius: 8px;
    background: var(--gris-texte);
    color: var(--blanc);
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.toast-lancement.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablette en portrait : 2 × 4 ---------- */
@media (max-width: 1023px) and (orientation: portrait) {
    .page-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: clamp(140px, 16vh, 220px); gap: 16px; }
    .carrousel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "fenetre" "points"; }
    .carrousel-fleche { display: none; } /* navigation par glissement du doigt et par les points */
}
@media (max-width: 1023px) and (orientation: landscape) {
    .page-tuiles { gap: 16px; grid-auto-rows: clamp(140px, 30vh, 220px); }
    .tuile-nom { font-size: 17px; }
}

/* ---------- Animations réduites ---------- */
@media (prefers-reduced-motion: reduce) {
    .carrousel-piste, .tuile, .tuile::before, .toast-lancement, .carrousel-point::before { transition: none; }
    .tuile:hover { transform: none; }
}
