﻿/* ==========================================================================
   Admin · Communication › App Front Page (2026-12-03)
   The website banners: an ordered list at the banner's own 1920 × 450 proportions, so the admin sees the
   front page's order at a glance; the Add form puts the image first as a large drop area with a live preview.
   Builds on employee-list.css (ev-*) and manage-access.css (ma-*). Tokens only.
   ========================================================================== */

/* ---- Panel ---- */
.cm-panel { padding: 0; overflow: hidden; }
.cm-panel__head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 20px 24px; border-bottom: 1px solid var(--tb-border); }
.cm-panel__head > div:first-child { flex: 1 1 220px; min-width: 0; }
.cm-panel__title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--tb-text-strong); }
.cm-panel__sub { margin-top: 2px; font-size: 13.5px; color: var(--tb-text-muted); }
.cm-panel__sub .num { color: var(--tb-primary); font-weight: 600; }

/* 5 slots: how many of the 5 places are used */
.cm-slots { display: flex; gap: 6px; }
.cm-slots__dot { width: 22px; height: 6px; border-radius: var(--tb-radius-pill); background: var(--tb-ice-2); }
.cm-slots__dot.is-on { background: var(--tb-primary); }

/* ---- Banner list ---- */
.cm-list { list-style: none; margin: 0; padding: 0; }
.cm-item { display: grid; grid-template-columns: 40px minmax(220px, 360px) minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 18px 24px; }
.cm-item + .cm-item { border-top: 1px solid var(--tb-border); }
.cm-item__pos { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--tb-ice); color: var(--tb-primary); font-size: 15px; font-weight: 700; }
.cm-item:first-child .cm-item__pos { background: var(--tb-primary); color: var(--tb-on-strong); }
.cm-item__thumb,
.cm-dialog__thumb { aspect-ratio: 1920 / 450; overflow: hidden; border-radius: 10px; border: 1px solid var(--tb-border); background: var(--tb-surface-muted); }
.cm-item__thumb img,
.cm-dialog__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cm-item__body { min-width: 0; }
.cm-item__link { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; }
.cm-item__link .ic { flex-shrink: 0; width: 15px; height: 15px; color: var(--tb-text-muted); }
.cm-item__link a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tb-royal); }
.cm-item__link--none { font-weight: 500; color: var(--tb-text-muted); }
.cm-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 13px; color: var(--tb-text-neutral); }
.cm-tag--size { background: var(--tb-warning-soft); color: var(--tb-warn-ink); }
.cm-item .ev-by { margin-top: 4px; }
.cm-item__actions { display: flex; gap: 8px; }
html body .cm .cm-del { color: var(--tb-danger); }
html body .cm .cm-del:hover { background: var(--tb-danger-soft); color: var(--tb-danger-ink); }
.cm-empty { padding: 48px 24px; }
.cm-full { padding: 48px 24px; text-align: center; }

/* ---- Add form ---- */
.cm-form__head { margin-bottom: 20px; }
.cm-form__title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--tb-text-strong); }
.cm-form__sub { margin-top: 2px; font-size: 13.5px; color: var(--tb-text-muted); }
.cm-form__grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.cm-form__side { display: grid; gap: 18px; }
.cm-form__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--tb-border); }

.cm-drop { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1920 / 450; min-height: 132px; margin-top: 6px; overflow: hidden; border: 1.5px dashed var(--tb-border-strong); border-radius: 12px; background: var(--tb-ice); cursor: pointer; transition: border-color .15s, background-color .15s; }
.cm-drop:hover, .cm-drop.is-over { border-color: var(--tb-royal); background: var(--tb-ice-2); }
.cm-drop:focus-within { outline: 2px solid var(--tb-royal); outline-offset: 2px; }
.cm-drop.has-image { border-style: solid; border-color: var(--tb-border); background: var(--tb-surface-muted); }
.cm-drop__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; text-align: center; }
.cm-drop__empty .ic { width: 28px; height: 28px; color: var(--tb-royal); margin-bottom: 4px; }
.cm-drop__title { font-size: 15px; font-weight: 600; color: var(--tb-primary); }
.cm-drop__text { font-size: 13px; color: var(--tb-text-muted); }
.cm-drop__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cm-drop__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 8px; }
.cm-drop__meta .tb-hint { margin-top: 0; }
.tb-field.is-invalid .cm-drop { border-color: var(--tb-danger); }
.js-cm-file-info.is-warn { color: var(--tb-warn-ink); }

/* ---- Dialogs ---- */
.cm-dialog { max-width: 480px; }
.cm-dialog .cm-dialog__thumb { margin-top: 16px; }
.cm-dialog .tb-field { margin-top: 16px; }

/* ---- Narrow ---- */
@container adcontent (max-width: 900px) {
    .cm-item { grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "pos thumb thumb" "pos body actions"; align-items: start; row-gap: 12px; }
    .cm-item__pos { grid-area: pos; }
    .cm-item__thumb { grid-area: thumb; }
    .cm-item__body { grid-area: body; }
    .cm-item__actions { grid-area: actions; }
    .cm-form__grid { grid-template-columns: minmax(0, 1fr); }
}
@container adcontent (max-width: 560px) {
    .cm-panel__head, .cm-item { padding-left: 16px; padding-right: 16px; }
    .cm-item { grid-template-columns: 32px minmax(0, 1fr); grid-template-areas: "pos thumb" "pos body" "pos actions"; column-gap: 12px; }
    .cm-item__pos { width: 30px; height: 30px; font-size: 14px; }
    .cm-form__actions .btn { flex: 1 1 0; }
}

/* ---- List-first (2026-12-03): the upload form inside the side panel ---- */
html body .cm .lf-drawer .cm-form { padding: 0; }
.lf-drawer .cm-form__head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 22px 20px 18px 28px; border-bottom: 1px solid var(--tb-border); background: var(--tb-surface); }
.lf-drawer .cm-form__head .lf-drawer__close { margin-left: auto; }
.lf-drawer .cm-form .ma-form__alert { margin: 20px 28px 0; }
.lf-drawer .cm-form__grid { grid-template-columns: minmax(0, 1fr); padding: 22px 28px; }
.lf-drawer .cm-form__actions { position: sticky; bottom: 0; margin: auto 0 0; padding: 14px 28px; flex-wrap: nowrap; background: var(--tb-surface); }
.lf-drawer .cm-form__actions .js-lf-clear { order: 0; margin-right: auto; }
.lf-drawer .cm-form__actions .js-lf-close { order: 1; }
.lf-drawer .cm-form__actions [type="submit"] { order: 2; }
@media (max-width: 640px) {
    .lf-drawer .cm-form__head { padding: 18px 12px 14px 20px; }
    .lf-drawer .cm-form .ma-form__alert { margin: 16px 20px 0; }
    .lf-drawer .cm-form__grid { padding: 20px; }
    .lf-drawer .cm-form__actions { padding: 12px 20px; }
    .lf-drawer .cm-form__actions .btn { flex: 0 1 auto; }
}
