/*
 * The inside of a list: the owner's page (/listes/{id}) and its wish rows, and the pieces of the
 * wish form (chips, "+" panels, photo drop). The values come from docs/maquettes/index.html and
 * ajout-v2.html; colours from tokens.css only. Everything fits a 360 px wide screen.
 */

/* The owner's page: the app bar of the mockups (layout.css), then the page itself. */
.list-page {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 64px;
}

.list-page .appbar {
    align-items: flex-start;
    padding-top: 16px;
}

.appbar-text {
    min-width: 0;
}

.list-page .apptitle {
    margin: 0;
    overflow-wrap: anywhere;
}

.appdate {
    display: block;
    margin-top: 2px;
    font-size: 0.8125rem;
    color: var(--muted);
}

.list-page .flash {
    margin: 0 0 12px;
}

/* Partager and Réglages, side by side. */
.page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* An archived list: still shown, still shared (decision 12), and reactivated from here. */
.archived-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--gold-soft);
    color: var(--gold-ink);
    font-size: 0.84375rem;
}

.archived-note p,
.archived-note form {
    margin: 0;
}

.archived-note .btn {
    width: auto;
    padding: 8px 14px;
    font-size: 0.84375rem;
}

/* No wish yet. */
.list-empty {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--lilac);
    text-align: center;
}

.empty-title {
    margin: 0;
    font: 650 1.0625rem/1.25 var(--display);
}

.list-empty .hint {
    margin: 6px 0 0;
}

/* The wishes: a row each, its photo, then what to know. */
.items {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
}

.prod {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    margin-top: 12px;
}

/* The page's message, moved to the top of its row after « Je le prends » (scroll-to-row): a
   line of its own, above the photo and the text. */
.prod > .flash {
    flex: 0 0 100%;
    margin: 0;
}

.thumb {
    width: 76px;
    height: 76px;
    flex: none;
    border-radius: 10px;
    background: var(--lilac);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prod-info {
    flex: 1;
    min-width: 0;
}

.prod-title {
    margin: 0;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.prod-info p {
    margin: 4px 0 0;
}

.price {
    font-size: 0.78125rem;
    color: var(--muted);
}

.price b {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.shop,
.qty,
.added-by {
    font-size: 0.78125rem;
    color: var(--muted);
}

/* What moderation hid of a wish (plan 08), and why: for its owner only. */
.moderated,
.shop.link-moderated {
    font-size: 0.78125rem;
    color: var(--accent);
}

.moderation-note p {
    margin: 0;
}

.moderation-note p + p {
    margin-top: 6px;
}

.hearts {
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: 3px;
    color: var(--accent);
}

.prod .hearts {
    font-size: 0.9375rem;
}

.hearts .off {
    color: var(--heart-off);
}

/*
 * What is taken of a wish: on the owner's rows of a list without surprise, and on the relatives'
 * cards once revealed (guest.css). The mockup's .reserved-by. The text in ink rather than in --ok,
 * which reads at 3.9:1 on --ok-soft, below the 4.5:1 of WCAG AA; the dot keeps its green.
 */
.resa-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--ok-soft);
    color: var(--ink);
    font-size: 0.8125rem;
}

.resa-status::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
}

.resa-status + .resa-status {
    margin-top: 6px;
}

.resa-status.mine {
    font-weight: 600;
}

/* Where the viewer's own reservation is managed: its page, or the link of its e-mail. */
.resa-help {
    margin: 6px 0 0;
    font-size: 0.78125rem;
    color: var(--muted);
}

.resa-help a {
    color: var(--ink);
    text-underline-offset: 3px;
    white-space: nowrap;
}

/* On a row, tighter than on a card. */
.prod-info .resa-status {
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 0.78125rem;
}

.prod-info .resa-status + .resa-status {
    margin-top: 4px;
}

/* « Je le prends », under what is taken of a wish. */
.owner-take {
    margin: 8px 0 0;
}

.owner-take .btn {
    width: auto;
    padding: 8px 14px;
    font-size: 0.84375rem;
}

/* Modifier and Retirer, under what to know of a wish. */
.prod-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
    margin-top: 6px;
    font-size: 0.8125rem;
}

.prod-actions a {
    color: var(--ink);
    text-underline-offset: 3px;
}

.prod-actions form {
    margin: 0;
}

/* ↑ and ↓, on the right of a wish: ↑ at the top and ↓ at the bottom, even when alone. */
.prod-move {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.prod-move .down {
    margin-top: auto;
}

/* A button that shows a sign, its name in aria-label: 44 px square, a finger's target on a phone. */
.icon-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--chip-line);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* « Ajouter un souhait », after the wishes. */
.add-item {
    margin-top: 16px;
}

/* The "+" of the wish form: each chip opens its panel. */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* The bar of chips, shown by the chips controller only: "display: flex" would beat "hidden". */
.chips[hidden] {
    display: none;
}

/* « + Plus de détails » (plan 17, decision 7), alone where the bar will be: the label's space above. */
.chips.more {
    margin-top: 14px;
}

/* « Ajouter aussi », on its own line above its chips. */
.chips > .lbl {
    flex-basis: 100%;
    margin-bottom: 0;
}

.chip {
    font: inherit;
    font-size: 0.8125rem;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1.5px dashed var(--chip-line);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

/* A chip whose panel is open, and a priority chip whose radio is checked. */
.chip.on,
.chip:has(:checked) {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.chip:focus-visible,
.chip:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* A priority: its radio is inside the chip, out of sight but still reached by the keyboard. */
label.chip {
    position: relative;
    display: inline-block;
}

.chip input[type="radio"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

/* The hearts of a priority, in the colour of the mockup's. */
.chip .marks {
    color: var(--accent);
}

/*
 * A "+" panel, shown with its "open" class only (the mockup's rule). The panels are open without
 * JavaScript (decision 7): the wish form (task 6) renders them with "open".
 */
.extra {
    display: none;
}

.extra.open {
    display: block;
}

/*
 * Where to drop or pick a photo, on the wish form: the label of the file input, which it holds.
 * The photo chosen, or the current one, shows on its left (.photo-thumb).
 */
.photo-drop {
    position: relative;
    min-height: 110px;
    border-radius: var(--radius);
    border: 1.5px dashed var(--chip-line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 12px;
    text-align: center;
    color: var(--muted);
    font-size: 0.8125rem;
    background: var(--drop-bg);
    cursor: pointer;
}

.photo-drop b {
    display: block;
    color: var(--ink);
    font-size: 0.875rem;
    margin-bottom: 2px;
}

.photo-drop:has(:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* The file input: out of sight, never by style="" (CSP), but still reached by the keyboard. */
.photo-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.photo-thumb {
    flex: none;
    width: 92px;
    height: 92px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--lilac);
}

/* The wish form (/listes/{id}/souhaits/…), as ajout-v2.html « à la main ». */
.item-form > .lbl:first-child {
    margin-top: 4px;
}

textarea.f {
    resize: none;
    min-height: 60px;
}

/* The promo code's description, under its code. */
.f.promo-description {
    margin-top: 8px;
}

.f.qty-input {
    width: 90px;
}

/* Ajouter or Enregistrer, then Annuler: kept in view at the bottom of the screen, as the mockup's. */
.form-actions {
    position: sticky;
    bottom: 0;
    margin: 20px -16px 0;
    padding: 12px 16px 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 70%, transparent);
    text-align: center;
}

/* A field reached by the keyboard, or scrolled to, stays above those buttons. */
html:has(.form-actions) {
    scroll-padding-bottom: 120px;
}

.form-actions .cancel {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--muted);
    text-underline-offset: 3px;
}

.form-actions .cancel:hover,
.form-actions .cancel:focus-visible {
    color: var(--ink);
}


/*
 * « Avec qui tu tiens cette liste », in a list's settings (lot 19, D3): one row per person (her
 * buttons on a line of their own, task 8), then per pending invitation (its address, what it sees,
 * « Annuler »), the form « Ajouter quelqu’un » under them. A row goes on two lines on a phone rather
 * than squeeze an address.
 */
.people-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.people-list > li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.people-list > li:first-child {
    border-top: 0;
}

.person-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.person-setting {
    /* Its own width first (auto, never 0): next to a long address, it goes to the next line. */
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.people-list form {
    margin-left: auto;
}

/* « Lui montrer… » or « Lui cacher… », then « Retirer », at the start of the next line. */
.person-actions {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
}

.people-list .person-actions form {
    margin: 0;
}

.people-subtitle {
    margin: 18px 0 0;
    font-size: 0.875rem;
    font-weight: 650;
    color: var(--muted);
}

.people-invite {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
