/* rmq-files.css — Photos & Files on a job (sql/base/206): the overlay panel,
   the card's Photos / Files sections, and the viewer. Dark palette per the
   style guide; inline SVG glyphs; no solid blocks beyond the app's own. */

/* ── Action overlay: the Photos & Files panel ── */
.ja-tile.tile-photos { border-color: rgb(var(--teal-rgb) / 0.3); }
.ja-tile.tile-photos:hover { border-color: rgb(var(--teal-rgb) / 0.5); background: rgb(var(--teal-rgb) / 0.08); }

.ja-files-doors { display: flex; flex-direction: column; gap: 8px; }
.ja-files-door {
    display: flex; flex-direction: column; gap: 10px; padding: 12px 14px;
    border-radius: 10px; border: 1px solid var(--line-12);
    background: var(--surface-04);
}
.ja-files-door-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ja-files-door-head .ja-files-tag { margin: 0; flex: 0 1 220px; }
.ja-files-door-label { font-weight: 600; font-size: 0.9rem; color: var(--gray-e0); min-width: 62px; }
.ja-files-door-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ja-files-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
    border-radius: 8px; border: 1px solid rgb(var(--teal-rgb) / 0.4); background: rgb(var(--teal-rgb) / 0.1);
    color: var(--teal); font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.ja-files-btn:hover { background: rgb(var(--teal-rgb) / 0.2); }
.ja-files-btn:disabled { opacity: 0.5; cursor: default; }
.ja-files-tag { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; }
.ja-files-tag label { font-size: 0.8rem; color: var(--gray-a0); }
.ja-files-tag select { flex: 1; }
.ja-files-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ja-files-row { font-size: 0.8rem; color: var(--gray-e0); }
.ja-files-row-top { display: flex; justify-content: space-between; gap: 8px; }
.ja-files-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-files-row-state { color: var(--gray-a0); white-space: nowrap; }
.ja-files-row-state.done { color: var(--green); }
.ja-files-row-state.failed { color: var(--red); }
.ja-files-bar { height: 3px; background: var(--surface-08); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.ja-files-bar > div { height: 100%; width: 0; background: var(--teal); transition: width 0.2s; }

/* ── Card sections ── */
.rf-section-count { color: var(--gray-a0); font-weight: 400; font-size: 0.8rem; margin-left: 6px; }
.rf-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rf-thumb {
    position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--line-10); background: var(--surface-04);
    cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
    color: var(--gray-a0);
}
.rf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rf-thumb.dark { opacity: 0.45; }
.rf-thumb .rf-thumb-tag {
    position: absolute; left: 4px; bottom: 4px; font-size: 0.62rem; padding: 1px 6px;
    border-radius: 8px; background: rgb(var(--bg-3-rgb) / 0.85); color: var(--gray-e0); max-width: calc(100% - 8px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rf-thumb .rf-thumb-missing {
    position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
    font-size: 0.62rem; color: var(--red); padding-bottom: 4px; background: var(--scrim-35);
}
.rf-list { display: flex; flex-direction: column; gap: 6px; }
.rf-doc {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
    border: 1px solid var(--line-10); background: var(--surface-04);
    cursor: pointer; color: var(--gray-e0); text-align: left; font-family: inherit; width: 100%;
}
.rf-doc:hover { border-color: rgb(var(--teal-rgb) / 0.4); }
.rf-doc.dark { opacity: 0.5; }
.rf-doc svg { flex-shrink: 0; color: var(--teal); }
.rf-doc-main { min-width: 0; flex: 1; }
.rf-doc-name { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-doc-meta { font-size: 0.72rem; color: var(--gray-a0); }
.rf-doc-meta .missing { color: var(--red); }
.rf-see-all {
    grid-column: 1 / -1; background: none; border: 1px dashed rgb(var(--teal-rgb) / 0.4); border-radius: 8px;
    color: var(--teal); font-size: 0.8rem; font-weight: 600; padding: 8px; cursor: pointer; font-family: inherit; width: 100%;
}
.rf-see-all:hover { background: rgb(var(--teal-rgb) / 0.08); }
.rf-empty { color: var(--gray-a0); font-size: 0.8rem; }
.rf-empty a { color: var(--teal); }

/* ── Viewer ── */
/* above the page and the Action overlay (1000), BELOW the toast (2000) and the confirm / prompt dialogs (2100) */
#rmq-file-viewer { display: none; position: fixed; inset: 0; z-index: 1500; }
#rmq-file-viewer.open { display: block; }
/* the scrim also covers the status-bar and home-bar bands the viewer keeps clear (rmq-components.css 21a), and a tap
   there closes it like anywhere else on the scrim */
#rmq-file-viewer .rfv-backdrop { position: absolute; inset: calc(-1 * var(--rmq-safe-top, 0px)) 0 calc(-1 * var(--rmq-safe-bottom, 0px)); background: var(--scrim-80); }
#rmq-file-viewer .rfv-box {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(96vw, 900px); max-height: calc(100% - 4vh); overflow: auto;   /* 100%: the viewer less the inset bands */
    background: var(--bg-2); border: 1px solid var(--line-12); border-radius: 14px;
    padding: 12px 16px 16px; color: var(--gray-e0); box-sizing: border-box;
}
.rfv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rfv-title { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfv-icon-btn { background: none; border: none; color: var(--gray-a0); cursor: pointer; padding: 6px; display: flex; }
.rfv-icon-btn:hover { color: var(--gray-e0); }
.rfv-stage { position: relative; display: flex; align-items: center; justify-content: center; margin: 8px 0; min-height: 200px; }
.rfv-media { max-width: 100%; max-height: 62vh; display: flex; align-items: center; justify-content: center; }
.rfv-media img { max-width: 100%; max-height: 62vh; border-radius: 8px; display: block; }
.rfv-glyph { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--gray-a0); padding: 40px 20px; font-size: 0.85rem; }
.rfv-glyph svg { width: 56px; height: 56px; }
.rfv-nav {
    position: absolute; top: 50%; transform: translateY(-50%); background: rgb(var(--bg-3-rgb) / 0.85);
    border: 1px solid var(--line-15); color: var(--gray-e0); border-radius: 50%; width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.rfv-prev { left: 4px; } .rfv-next { right: 4px; }
.rfv-meta { color: var(--gray-a0); font-size: 0.78rem; margin: 4px 0 10px; }
.rfv-fields { display: flex; gap: 12px; flex-wrap: wrap; }
/* the tag menu opens UPWARD: the viewer box scrolls, so a menu below would be clipped */
.rfv-field .rmq-dropdown .rmq-menu { top: auto; bottom: calc(100% + 4px); box-shadow: 0 -8px 32px rgb(var(--shadow-rgb) / 0.5); }
.rfv-field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.rfv-field-caption { flex: 1; }
.rfv-field label { font-size: 0.75rem; color: var(--gray-a0); }
.rfv-field input {
    background: var(--surface-05); border: 1px solid var(--line-12); border-radius: 8px;
    color: var(--gray-e0); padding: 8px 10px; font-size: 0.85rem; font-family: inherit;
}
.rfv-move { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 10px; border-radius: 8px; border: 1px dashed rgb(var(--teal-rgb) / 0.4); }
.rfv-move label { font-size: 0.8rem; color: var(--gray-a0); }
.rfv-move .rmq-dropdown { flex: 1; min-width: 200px; }
.rfv-move .rmq-dropdown .rmq-menu { top: auto; bottom: calc(100% + 4px); box-shadow: 0 -8px 32px rgb(var(--shadow-rgb) / 0.5); }
.rfv-btns { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
.rfv-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px;
    border: 1px solid var(--line-15); background: var(--surface-06); color: var(--gray-e0);
    font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.rfv-btn:hover { background: var(--surface-10); }
.rfv-btn.danger { color: var(--red); border-color: rgb(var(--red-rgb) / 0.4); }
.rfv-btn.primary { background: rgb(var(--teal-rgb) / 0.15); border-color: rgb(var(--teal-rgb) / 0.4); color: var(--teal); }

@media (max-width: 480px) {
    .rf-strip { grid-template-columns: repeat(3, 1fr); }
    #rmq-file-viewer .rfv-box { width: 100vw; max-height: 100%; border-radius: 0; top: 0; left: 0; transform: none; height: 100%; }
    .rfv-media, .rfv-media img { max-height: 50vh; }
}
