/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 * Ref: CI-see-collection-builder
 *
 * Budget: a FIXED 620px iframe in explore. Form on the left, collection on the
 * right, and the collection scrolls internally as it grows across the module.
 * Palette + [hidden] fix: ../shared/css/see-activity.css
 */

.cb-container { display: flex; flex-direction: column; gap: .35rem; }

.cb-hook {
    margin: 0;
    padding: .25rem .7rem;
    border-radius: 10px;
    background: var(--see-subtle);
    border-left: 5px solid var(--see-accent);
    color: var(--see-ink);
    font-size: .8rem;
    line-height: 1.25;
}

.cb-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: .6rem;
    align-items: start;
}

/* ---------------------------------------------------------------- form */
.cb-form { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }

.cb-kinds { display: flex; flex-wrap: wrap; gap: .2rem; }

.cb-kind {
    min-height: 34px;
    padding: .12rem .6rem;
    border-radius: 999px;
    border: 2px solid var(--maths-border);
    background: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: .8rem;
    color: var(--see-ink);
    cursor: pointer;
}

.cb-kind.is-active { background: var(--see-accent); border-color: var(--see-accent); color: #fff; }

/* Scrolls rather than pushing the fixed 620px iframe over: a lesson may ask
 * for five or six fields per item, and the collection beside it must stay
 * visible while a child types. */
.cb-fields {
    display: flex;
    flex-direction: column;
    gap: .22rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: .15rem;
}

.cb-field { display: flex; flex-direction: column; gap: .05rem; }

.cb-field-label {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    font-size: .74rem;
    font-weight: 800;
    color: var(--maths-ink-muted);
}

/* "needed", not an asterisk: a child should be able to read why. */
.cb-req {
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    background: var(--see-accent);
    border-radius: 999px;
    padding: 0 .35rem;
}

.cb-input {
    width: 100%;
    min-height: 34px;
    border-radius: 8px;
    border: 2px solid var(--maths-border);
    padding: .2rem .5rem;
    font-family: 'Nunito', sans-serif;
    font-size: .9rem;
    background: #fff;
    resize: vertical;
}

.cb-input:focus-visible { outline: 3px solid var(--maths-focus-ring); outline-offset: 1px; }

.cb-save { min-height: 42px; }
.cb-save:disabled { opacity: .5; cursor: not-allowed; }

/* The reason, on the page, rather than an error after the press. */
.cb-why {
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    color: var(--see-accent);
    text-align: center;
}

/* ---------------------------------------------------------- collection */
.cb-collection { min-width: 0; display: flex; flex-direction: column; gap: .25rem; }

.cb-collection-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .4rem;
    flex-wrap: wrap;
}

.cb-collection-title { margin: 0; font-size: .95rem; font-weight: 800; color: var(--see-ink); }

.cb-groupby { display: flex; gap: .2rem; }

.cb-gb {
    border: 1px solid var(--maths-border);
    background: #fff;
    border-radius: 999px;
    padding: .05rem .5rem;
    font-family: 'Nunito', sans-serif;
    font-size: .7rem;
    font-weight: 700;
    color: var(--maths-ink-muted);
    cursor: pointer;
    min-height: 26px;
}

.cb-gb.is-active { background: var(--see-subtle); border-color: var(--see-bright); color: var(--see-ink); }

.cb-grid { overflow-y: auto; max-height: 310px; padding-right: .15rem; }

.cb-group-head {
    margin: .3rem 0 .15rem;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--maths-ink-muted);
}

.cb-group-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .3rem; }

/* ONE card style. An item from a book and an item from a grandmother render
 * identically: no badge, no tint, nothing to compare. The only difference is
 * the words in the credit line. */
.cb-card {
    border: 1px solid var(--maths-border);
    border-top: 4px solid var(--see-bright);
    border-radius: 9px;
    padding: .3rem .45rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    margin-bottom: .3rem;
}

.cb-group-row .cb-card { margin-bottom: 0; }

.cb-card-kind {
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--see-accent);
}

.cb-card-img { width: 100%; max-height: 80px; object-fit: cover; border-radius: 5px; }

.cb-card-text {
    margin: 0;
    font-size: .86rem;
    line-height: 1.3;
    color: var(--maths-ink);
}

/* The credit line is the point of the whole activity. */
.cb-card-credit {
    margin: 0;
    font-size: .74rem;
    font-style: italic;
    color: var(--see-ink);
}

.cb-empty {
    margin: 0;
    padding: .8rem;
    text-align: center;
    color: var(--maths-ink-muted);
    font-size: .88rem;
}

/* --------------------------------------------------------- display mode */
body.display-mode .cb-form { display: none !important; }
body.display-mode .cb-main { grid-template-columns: 1fr; }
body.display-mode .cb-grid { max-height: 470px; }
body.display-mode .cb-group-row { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
body.display-mode .cb-card-text { font-size: .95rem; }
body.display-mode .cb-collection-title { font-size: 1.1rem; }

@media (max-width: 680px) {
    .cb-main { grid-template-columns: 1fr; }
    .cb-grid { max-height: 220px; }
}
