/* Bildauswahl am Artikelformular.
   Nur Struktur und Maße, damit die Auswahl bedienbar ist. Farben, Radien und
   Feinheiten gehören in app.css und können hier alles überschreiben – diese
   Datei wird vor app.css geladen. */

.bildwahl {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bildwahl-titel {
    font-size: 13px;
    font-weight: 600;
}

.bildwahl-kopf {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

/* Feste Kachel: sonst springt das Formular, sobald ein Bild gewählt wird. */
.bildwahl-vorschau {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    font-size: 24px;
    font-weight: 700;
    color: rgba(0, 0, 0, .32);
}

.bildwahl-vorschau img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bildwahl-neben {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.bildwahl-neben small {
    overflow-wrap: anywhere;
}

.bildwahl-katalog {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 8px;
}

.bildwahl-katalog input[type="search"] {
    width: 100%;
}

/* Höhe begrenzt, sonst schiebt der Katalog die Speichern-Schaltfläche
   außer Sichtweite. */
.bildwahl-gruppen {
    max-height: 420px;
    overflow-y: auto;
}

.bildwahl-gruppe + .bildwahl-gruppe {
    margin-top: 10px;
}

/* Aufklappbar, weil der Katalog rund 800 Zeichen umfasst. Zugeklappte
   Gruppen zeichnen ihre Kacheln gar nicht erst. */
.bildwahl-gruppe > summary {
    cursor: pointer;
    padding: 4px 0;
    font-size: 13px;
    font-weight: 600;
}

.bildwahl-gruppe > p {
    margin: 2px 0 8px;
    font-size: 12px;
    opacity: .7;
}

.bildwahl-gruppe > .knopf {
    margin-top: 8px;
}

.bildwahl-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.bildwahl-kachel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    text-align: center;
}

.bildwahl-kachel img {
    width: 100%;
    height: 56px;
    object-fit: contain;
}

.bildwahl-kachel strong {
    font-size: 11px;
    line-height: 1.2;
}

.bildwahl-kachel span {
    font-size: 10px;
    line-height: 1.25;
    opacity: .75;
}

.bildwahl-kachel[aria-pressed="true"] {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.bildwahl-leer {
    margin: 0;
    font-size: 12px;
    opacity: .7;
}

@media (max-width: 700px) {
    .bildwahl-gruppen { max-height: 260px; }
    .bildwahl-liste   { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
