/* entity-files.css -- the organized Files tab on record pages (Story 3520).
   Builds on entity-detail.css (.ed-card, .ed-btn) and files/file-kit.css (chips,
   type badges, sheets). */

.ef-pane { position: relative; }
.ef-pane.ef-drop { outline: 3px dashed #0A66C2; outline-offset: -8px; background: #F4F9FF; }

.ef-actions .ed-btn.on { background: #0A66C2; color: #fff; border-color: #0A66C2; }
.ef-summary { margin-left: auto; font-size: 12px; color: #555; }

/* The Files tab's head row (Story 3528): the caret rolls every tool below it up,
   and the summary rides in it so the count stays in view. */
.ef-tools-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: none; border: none; border-bottom: 1px solid #E2E8F0;
    padding: 4px 0 6px; margin: 0 0 8px; cursor: pointer; text-align: left;
    font: 12px "Segoe UI", system-ui, sans-serif;
}
.ef-tools-toggle .ef-summary { margin-left: 0; flex: 1 1 auto; min-width: 0; }
.ef-tools-toggle:hover .ef-caret { color: #0A66C2; }
.ef-pane.ef-tools-collapsed .ef-tools { display: none; }

/* Search: alone on its row, full width. */
.ef-search {
    display: block; width: 100%; box-sizing: border-box;
    padding: 8px 10px; margin: 0 0 8px;
    border: 1px solid #C9D0D8; border-radius: 4px;
    font: 14px "Segoe UI", system-ui, sans-serif;
}

.ef-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.ef-seg { display: inline-flex; border: 1px solid #C9D7E8; border-radius: 4px; overflow: hidden; }
.ef-seg button {
    background: #fff; color: #0A66C2; border: none; border-right: 1px solid #C9D7E8;
    padding: 6px 12px; font: 12px "Segoe UI", system-ui, sans-serif; cursor: pointer;
}
.ef-seg button:last-child { border-right: none; }
.ef-seg button.on { background: #0A66C2; color: #fff; }
/* The sort row: every icon button is the same size -- as tall as the sort box (the row
   stretches them) and one fixed width -- on Files, Notes and Web alike. */
.ef-sort { display: inline-flex; gap: 6px; align-items: stretch; margin-left: auto; min-width: 180px; }
.ef-sort .ps-select, .ef-sort select { min-width: 150px; }
.ef-sort > button:not(.ps-select) { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
    flex: 0 0 40px; width: 40px; padding: 0; font-size: 14px; line-height: 1; }
.ef-sort > button:not(.ps-select)[hidden] { display: none; }

.ef-banner {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    background: #FEF3C7; border: 1px solid #FCD34D; color: #92400E;
    border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px;
}
.ef-banner[hidden] { display: none; }

/* ---- Bands ---- */
.ef-band { margin-bottom: 12px; }
.ef-band-head {
    display: flex; align-items: center; gap: 8px;
    border-bottom: 2px solid #E2E8F0; padding: 2px 0 4px; margin-bottom: 8px;
}
.ef-band-toggle {
    display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto;
    background: none; border: none; padding: 4px 0; cursor: pointer; text-align: left;
    font: 600 13px "Segoe UI", system-ui, sans-serif; color: #1E293B;
}
.ef-caret { width: 12px; color: #64748B; font-size: 11px; }
.ef-band-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.ef-band-count {
    font-weight: 400; font-size: 11px; color: #475569;
    background: #F1F5F9; border-radius: 999px; padding: 1px 8px;
}
.ef-band.collapsed .ef-band-body { display: none; }
.ef-band.collapsed .ef-band-head { margin-bottom: 0; }
.ef-band-action { padding: 4px 10px; font-size: 11px; }
.ef-band-check { width: 18px; height: 18px; }

.ef-band-staging .ef-band-head { border-bottom-color: #FCD34D; }
.ef-band-staging .ef-band-toggle { color: #92400E; }
.ef-band-staging .ef-band-count { background: #FEF3C7; color: #92400E; }

/* ---- Cards ---- */
.ef-card { position: relative; }
.ef-card.ef-staged { border-left: 3px solid #F59E0B; }
.ef-card.ef-important { border-color: #F2C94C; background: #FFFDF3; }
.ef-card.ef-sel { border-color: #0A66C2; background: #ECF4FD; box-shadow: 0 0 0 1px #0A66C2 inset; }
.ef-card.ef-flash { animation: ef-flash 1.6s ease-out 2; }
@keyframes ef-flash { 0% { background: #DBEAFE; } 100% { background: #FAFAFC; } }

.ef-top { display: flex; align-items: center; gap: 8px; }
.ef-check { width: 18px; height: 18px; flex: 0 0 auto; }
.ef-name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; color: #111; word-break: break-word; }
.ef-flag {
    background: none; border: 1px solid transparent; border-radius: 4px;
    color: #94A3B8; font-size: 16px; line-height: 1; padding: 3px 6px; cursor: pointer; flex: 0 0 auto;
}
.ef-flag:hover { border-color: #E2E8F0; color: #64748B; }
.ef-flag.on { color: #D97706; }

.ef-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-top: 6px; font-size: 11px; color: #64748B;
}
.ef-sep { color: #CBD5E1; }
.ef-docdate { color: #334155; font-weight: 600; }
/* Leonardo Secure Files (Story 3531): same lock tag as the Leonardo Files page. */
.ef-lock { font-size: 11px; font-weight: 600; color: #065F46; background: #D1FAE5;
           border: 1px solid #6EE7B7; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.ef-desc { font-size: 12px; color: #333; margin-top: 6px; word-break: break-word; }

.ef-fileto {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed #F5D38A;
}
.ef-fileto-lbl { font-size: 11px; color: #92400E; font-weight: 600; margin-right: 2px; }
.ef-more-chip { --fk-c: #0A66C2; background: #fff; }

.ef-pane.ef-selecting .ef-card { cursor: pointer; }

.ef-more { text-align: center; padding: 6px 0 12px; }
.ef-more[hidden] { display: none; }

/* Selection bar: sticks to the bottom of the scrolling body while selecting. */
.ef-selbar {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    background: #1E293B; color: #fff; border-radius: 8px;
    padding: 10px 12px; margin-top: 8px; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.15);
}
.ef-selbar[hidden] { display: none; }
.ef-selcount { flex: 1 1 auto; font-size: 13px; }
.ef-selbar .ed-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
    .ef-summary { flex-basis: 100%; margin-left: 0; order: 9; }
    .ef-tools-toggle .ef-summary { flex-basis: auto; order: 0; }
    .ef-sort { margin-left: 0; flex: 1 1 100%; }
    .ef-sort .ps-select, .ef-sort select { flex: 1 1 auto; }
    .ef-seg { flex: 1 1 100%; }
    .ef-seg button { flex: 1 1 0; }
    .ef-card .ed-card-actions { flex-wrap: wrap; }
}

/* ---- Arrange (drag the category groups into order) ---- */
.ef-arrange.on { background: #0A66C2; color: #fff; border-color: #0A66C2; }
/* While arranging, every group shrinks to its header so a whole list fits on a phone. */
.ef-pane.ef-arranging .ef-band-body { display: none; }
.ef-pane.ef-arranging .ef-band-head { margin-bottom: 0; }
.ef-pane.ef-arranging .ef-band { margin-bottom: 6px; }
.ef-pane:not(.ef-arranging) .ef-grip { display: none; }
.ef-grip {
    flex: 0 0 auto; cursor: grab; color: #4B5563; background: #E5E7EB; border: 1px solid #D1D5DB;
    border-radius: 4px; padding: 6px 8px 6px 6px; font-size: 14px; line-height: 1; letter-spacing: -3px;
    touch-action: none; user-select: none;
}
.ef-grip:hover { background: #DBEAFE; border-color: #93C5FD; color: #1D4ED8; }
.ef-grip:active { cursor: grabbing; }
.ef-band.dragging { opacity: .55; outline: 2px dashed #2563EB; outline-offset: -2px; }
.ef-pane.ef-arranging .ef-caret { visibility: hidden; }

/* ---- the preview view: the Bay Window (picasso-split.css), as on the Notes tab ----
   Off, none of this shows and the tab looks exactly as it always has. */
.ef-split:not(.ps-on) > .ef-pvpane { display: none; }
.ef-viewbtn.on { background: #0A66C2; color: #fff; border-color: #0A66C2; }
.ef-viewbtn[hidden] { display: none; }
.ef-split.ps-on { height: min(78vh, 900px); height: min(78dvh, 900px); min-height: 360px; margin-top: 8px;
    border: 1px solid #E2E2E5; border-radius: 6px; background: #fff; overflow: hidden; }
.ef-split.ps-on > .ef-listwrap { background: #F8FAFC; padding: 0 6px 6px; }
.ef-split.ps-on > .ef-listwrap > .ps-listbar { margin: 0 -6px 6px; }
.ef-split.ps-on .ef-card { cursor: pointer; }
.ef-split.ps-on .ef-card.ef-pv-on { border-color: #0A66C2; background: #EFF6FF; }
.ef-pvpane .ef-pv-head { flex: 0 0 auto; padding: 10px 14px 8px; border-bottom: 1px solid #E2E2E5; }
.ef-pvpane .ef-pv-head:empty { display: none; }
.ef-pv-title { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ef-pv-title h3 { flex: 1 1 160px; min-width: 0; margin: 0; font-size: 15px; color: #0F172A; word-break: break-word; }
.ef-pv-meta { margin-top: 6px; }
.ef-pvpane .ef-pv-body { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column; }
.ef-pvpane .ef-pv-body .ed-empty { padding: 20px 14px; }
.ef-pv-pages { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; background: #E5E7EB; min-height: 100%; }
.ef-pv-pages canvas { display: block; max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.ef-pv-img { padding: 12px; text-align: center; }
.ef-pv-img img { max-width: 100%; height: auto; }
.ef-pv-text { margin: 0; padding: 12px 14px; white-space: pre-wrap; word-break: break-word;
    font: 13px/1.5 Consolas, "Cascadia Mono", monospace; color: #111; }
.ef-pv-frame { flex: 1 1 auto; width: 100%; min-height: 100%; border: 0; background: #fff; }
.ef-pv-none { padding: 20px 14px; color: #475569; }
.ef-pv-none .ed-btn { margin-top: 10px; }

/* ---- The View sheet (a file's View button) ----
   The Record View's sepia shell (.ed-rview in entity-detail.css), taller and wider so a
   document has room. Sepia for text, markdown and PDFs; a picture on a dark backdrop;
   a web page keeps its own colours. The body is the one scroller; the buttons stay put. */
.ed-rview-bg.ef-view-bg { z-index: 1100; }
.ed-rview.ef-view { width: min(1000px, 100%); height: 92vh; height: 92dvh; max-height: none; }
.ef-view-head {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 14px 64px 12px 20px;
    border-bottom: 1px solid #d8c9a6;
}
/* Story 5705: the sheet's X sits in the head's right end. */
.ef-view .ed-sheet-x { top: 6px; right: 12px; }
.ef-view-title {
    margin: 0; min-width: 0;
    font: 700 18px/1.3 "Segoe UI", system-ui, sans-serif; color: #3b3323;
    overflow-wrap: anywhere;
}
.ef-view-body {
    flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column;
}
.ef-view-body .ed-empty { padding: 20px; color: #6f6144; }
.ef-view .ef-pv-pages { background: #efe5cc; }
.ef-view .ef-pv-text {
    padding: 22px 26px; color: #3b3323;
    font: 15px/1.6 Georgia, "Iowan Old Style", "Times New Roman", serif;
}
.ef-view .ef-pv-frame { background: #f7f0df; }
.ef-view .ef-pv-none { color: #6f6144; padding: 22px 26px; }
.ef-view.ef-view-plain .ef-pv-frame { background: #fff; }
.ef-view.ef-view-dark .ef-view-body { background: #1f2023; }
.ef-view.ef-view-dark .ef-pv-img { display: flex; align-items: center; justify-content: center; flex: 1 1 auto; }
.ef-view.ef-view-dark .ef-pv-img img { max-height: calc(92dvh - 140px); object-fit: contain; }
.ef-view-head [hidden], .ef-view [hidden] { display: none; }
@media (max-width: 520px) {
    .ed-rview-bg.ef-view-bg { padding: 8px; }
    .ed-rview.ef-view { height: 96vh; height: 96dvh; }
    .ef-view-head { padding: 12px 58px 10px 14px; }
    .ef-view .ed-sheet-x { top: 4px; right: 8px; }
    .ef-view-title { font-size: 16px; }
    .ef-view .ef-pv-text { padding: 16px 16px; font-size: 14px; }
}
