/* SPDX-FileCopyrightText: 2020-2026 les contributeurs CapsuleOS
   SPDX-License-Identifier: GPL-3.0-or-later

   Panneau « Missions » (checklist pédagogique) pour la peau Android — affordance CapsuleOS, pas un élément du
   système réel : feuille du bas (bottom sheet) Material, repliable. Skin concret et autonome (la base noref
   checklist.base.css n'est PAS chargée côté mobile) ; la logique (ouverture, cases, progression) vient de
   usr/lib/capsuleos/shells/common/checklist.js, qui ne fait que poser les classes is-done et la largeur de barre. */

#checklist {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    max-height: 62vh;
    display: none;
    flex-direction: column;
    background: #fff;
    color: #1b1b1f;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, .28);
    font-family: "Roboto", "Google Sans", system-ui, sans-serif;
    overflow: hidden;
}

/* Affiché (feuille du bas) quand un module est monté ; replié par défaut (seul l'en-tête et la barre de
   progression), déplié au toucher de l'en-tête. */
#checklist.is-active { display: flex; }

/* Le repli est un comportement de la feuille du bas AUTONOME uniquement. Hébergé dans l'aside (heberger() pose
   .capsule-aside__guest), le panneau n'a aucun geste de dépliage : les étapes doivent être visibles d'emblée
   (user-flow 8e3ae6 : étapes jamais visibles après lancement, module impraticable). */
#checklist:not(.is-expanded):not(.capsule-aside__guest) .checklist-app__description,
#checklist:not(.is-expanded):not(.capsule-aside__guest) .checklist-app__list {
    display: none;
}

#checklist.is-active .checklist-app__header {
    cursor: pointer;
}

/* Poignée de feuille du bas (geste d'attrape visuel). */
#checklist::before {
    content: "";
    display: block;
    width: 32px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: #c4c6cf;
    flex: 0 0 auto;
}

/* En aside : plus de repli, donc ni poignée ni curseur main (affordances devenues trompeuses). */
#checklist.capsule-aside__guest::before { display: none; }
#checklist.capsule-aside__guest.is-active .checklist-app__header { cursor: default; }

body.sf-private #checklist,
body.and-dark #checklist {
    background: #1b1b1f;
    color: #e3e2e6;
}

main#checklistApp {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.checklist-app__header {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    top: 0;
    background: inherit;
    padding-top: 4px;
}

.checklist-app__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.checklist-app__progress-wrap {
    flex: 1 1 120px;
    height: 6px;
    min-width: 96px;
    border-radius: 3px;
    background: #e3e2e6;
    overflow: hidden;
}

body.and-dark .checklist-app__progress-wrap { background: #44464f; }

.checklist-app__progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: #0b57d0;
    transition: width .3s ease;
}

.checklist-app__progress-label {
    font-size: .82rem;
    color: #44474e;
    flex: 0 0 auto;
}

body.and-dark .checklist-app__progress-label { color: #c4c6cf; }

.checklist-app__description {
    margin: 0;
    font-size: .9rem;
    line-height: 1.4;
    color: #44474e;
}

body.and-dark .checklist-app__description { color: #c4c6cf; }

.checklist-app__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checklist-group {
    list-style: none;
    display: block;
}

.checklist-group__title {
    display: block;
    margin: 12px 0 2px;
    font-size: .95rem;
    font-weight: 500;
}

.checklist-group__objective {
    display: block;
    margin: 0 0 6px;
    font-size: .82rem;
    color: #44474e;
}

body.and-dark .checklist-group__objective { color: #c4c6cf; }

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 4px;
    border-radius: 12px;
}

.checklist-item__check {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin-top: 1px;
    padding: 0;
    border: 2px solid #757780;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.checklist-item.is-done .checklist-item__check {
    border-color: #0b57d0;
    background: #0b57d0;
}

.checklist-item__tick {
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.checklist-item.is-done .checklist-item__tick { opacity: 1; }

.checklist-item__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.checklist-item__name {
    font-size: .95rem;
    line-height: 1.35;
}

.checklist-item.is-done .checklist-item__name {
    color: #44474e;
    text-decoration: line-through;
}

body.and-dark .checklist-item.is-done .checklist-item__name { color: #8e9099; }

.checklist-item__hint,
.checklist-item__help {
    font-size: .82rem;
    line-height: 1.4;
    color: #44474e;
}

body.and-dark .checklist-item__hint,
body.and-dark .checklist-item__help { color: #c4c6cf; }

.checklist-item__more {
    align-self: flex-start;
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0b57d0;
    font-size: .82rem;
    cursor: pointer;
}

body.and-dark .checklist-item__more { color: #a8c7fa; }
