
/* ==========================================================================
   Archive (Arkivplats)
   The page is a folder tree beside a file list. The tree itself is TafelTree
   and stays legacy — see open-questions.md.
   ========================================================================== */

.archive_layout {
    align-items: start;
}

.archive_sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* The file picker (archive_external) renders headerless in a Modalbox iframe: drop the top bar's
   reserved margin and give the page its own gutter. */
.modal_edit_layout:has(.archive_layout--external) #main {
    margin-top: 0;
}

.modal_edit_layout:has(.archive_layout--external) .content_wrapper_2 {
    padding: var(--spacing-lg);
}

/* base.css forces a scrollbar on html; in the picker it should appear only for a long file list. */
html:has(.archive_layout--external) {
    overflow-y: auto;
}

.modal_edit_layout:has(.archive_layout--external) #container_modal_edit {
    margin: 0;
    padding: 0;
}

/* The Modalbox that hosts the picker (archive/common/external_archive.htm): the iframe fills the
   dialog body exactly, so only the page inside it scrolls. Its width/height attributes lose to this. */
#MB_content:has(> #modal_archive_div) {
    padding: 0;
    overflow: hidden;
}

#modal_archive_div {
    height: 100%;
}

#modal_archive_div > #external_iframe {
    display: block;
    width: 100%;
    height: 100%;
}

/* The iframe is ~1000px wide, where app-grid--sidebar stacks; keep tree and list side by side. */
.app-grid.archive_layout--external {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--spacing-xl);
}

.archive_external_actions {
    margin-bottom: var(--spacing-sm);
}

/* The search sits above the tree, in the same card: it filters the whole archive, not the folder
   currently open, so it belongs with the navigation rather than with the list. */
.archive_search {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0 0 var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-secondary);
}

.archive_search .app-input {
    flex: 1;
}

/* The clear button appears only once something is typed. :placeholder-shown is what tells us the
   field is empty, so this needs no script — the field has a placeholder for exactly that reason. */
.archive_search_clear {
    font-size: var(--icon-size-md);
    color: var(--text-tertiary);
}

.archive_search_clear:hover {
    color: var(--text-primary);
}

.archive_search_field .app-input__field:placeholder-shown ~ .archive_search_clear {
    display: none;
}

/* The folder tree reads at body-md; the file list beside it uses the standard list size. */
#treediv,
#treediv td {
    font-size: var(--font-body-md-size);
    line-height: var(--font-body-md-line-height);
}

/* TafelTree lays its branches out as table rows with no padding of their own, so the folders sat
   flush against each other and the label against its icon. */
#treediv td {
    padding-block: var(--spacing-xs);
}

#treediv td:has(> img[src$="folder.png"])::after,
#treediv td:has(> img[src$="folder_disabled.png"])::after,
#treediv td:has(> img[src$="trashcan.png"])::after {
    margin-right: var(--spacing-sm);
}

/* Breadcrumbs above the list: the folder path, with a chevron between crumbs.
   .novus_table_header_block is justify-content: flex-end and a fixed 55px, which pushed the path
   to the right-hand edge; here it reads from the left and sizes to its content. */
div.archive_breadcrumbs {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
    height: auto;
    padding: 0 0 calc(var(--spacing-sm) * 2);
}

/* The path is how you know where you are, so it reads as the list's heading rather than as one
   more line of metadata. */
.archive_crumb {
    font-size: var(--font-display-sm-size);
    line-height: var(--font-display-sm-line-height);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--font-display-sm-letter-spacing);
    color: var(--text-primary);
}

.archive_crumb:hover {
    color: var(--text-secondary);
}

.archive_crumb_divider {
    font-size: var(--icon-size-xl);
    color: var(--text-tertiary);
}

/* The list sits in a flush card, which has no padding of its own, so the lines above the table
   bring their own rather than running into the card's edge. */
.archive_email,
.archive_search_summary {
    margin: 0;
    padding: 0 0 var(--spacing-md);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

/* The address sits under the path, with a copy control that reads as one line with it. */
.archive_email {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin: 0 0 calc(var(--spacing-sm) * 2);
}

.archive_email_label {
    font-weight: var(--font-weight-medium);
}

.archive_email_copy {
    font-size: var(--icon-size-md);
    color: var(--text-tertiary);
}

.archive_email_copy:hover {
    color: var(--text-primary);
}

div.archive_search_summary {
    height: auto;
    justify-content: flex-start;
}

/* A folder in the list carries a symbol; a file carries the type icon PHP picked.
   .sym in app-main.css also sets a size at equal weight and loads later, so the list's icons are
   scoped to the fragment to settle the cascade rather than won on class count. */
.sym.archive_row_icon {
    font-size: var(--icon-size-lg);
    color: var(--icon-color-secondary);
}

.archive_row_icon--disabled {
    color: var(--text-tertiary);
}

/* Roughly the size Drive gives a file row's icon: big enough to read the type at a glance without
   competing with the name beside it. These were 16px images before. */
.sym.archive_file_icon {
    font-size: var(--icon-size-lg);
}

.archive_checkout_icon {
    font-size: var(--icon-size-md);
    color: var(--text-tertiary);
    margin-left: var(--spacing-xs);
}

/* The name column is the one that can hold a long file name; the rest hug their content.
   .ellipsis is only overflow + text-overflow, so without nowrap a capped cell wraps instead of
   truncating — the point of the cap is that one long name cannot stretch the table. */
.archive_name_cell {
    max-width: 320px;
    white-space: nowrap;
}

.archive_name_cell > div {
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive_export_delete {
    font-size: var(--icon-size-md);
    color: var(--icon-color-secondary);
}

.archive_export_delete:hover {
    color: var(--accent);
}

.archive_space_label {
    margin: 0 0 var(--spacing-xs);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

.archive_space_value {
    margin: 0 0 var(--spacing-sm);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
}

/* The file and folder count sat in <tfoot>, inside the scrolling wrapper, so it slid out of view
   with the table. Under the list it stays put whatever the table's width. */
div.archive_summary {
    height: auto;
    justify-content: flex-start;
    padding: var(--spacing-md) 0;
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   Folder tree
   TafelTree builds a table of <img> cells and cannot be told to use an icon
   font, so the images are hidden and the glyph is drawn on the cell. The tree's
   own behaviour and markup are untouched — see open-questions.md.
   --------------------------------------------------------------------------- */

/* The folder, inbox and trash images are passive, so they can simply go. */
#treediv td:has(> img[src$="folder.png"]) > img,
#treediv td:has(> img[src$="folder_disabled.png"]) > img,
#treediv td:has(> img[src$="trashcan.png"]) > img,
#treediv td:has(> img[src$="inbox.png"]) > img,
#treediv td:has(> img[src$="fndoc.png"]) > img {
    display: none;
}

/* The expand/collapse image is NOT passive: tree.js binds click, mouseover and
   mouseout to the <img> itself (_getImgBeforeIcon, ~line 4029). display:none took it
   out of hit testing and the arrow stopped opening folders, while the ::after glyph —
   a pseudo-element, which can never be a click target — looked like it should work.
   So the image stays in the flow and stays hittable; it is just invisible, and the
   glyph is painted underneath it. */
#treediv td:has(> img.tafelTreeopenable[src*="minus"]),
#treediv td:has(> img.tafelTreeopenable[src*="plus"]) {
    position: relative;
}

#treediv td:has(> img.tafelTreeopenable[src*="minus"]) > img,
#treediv td:has(> img.tafelTreeopenable[src*="plus"]) > img {
    position: relative;
    z-index: 1;
    width: var(--icon-size-md);
    height: var(--icon-size-md);
    opacity: 0;
    cursor: pointer;
}

#treediv td:has(> img[src$="folder.png"])::after,
#treediv td:has(> img[src$="folder_disabled.png"])::after,
#treediv td:has(> img[src$="trashcan.png"])::after,
#treediv td:has(> img[src$="inbox.png"])::after,
#treediv td:has(> img[src$="fndoc.png"])::after,
#treediv td:has(> img.tafelTreeopenable[src*="minus"])::after,
#treediv td:has(> img.tafelTreeopenable[src*="plus"])::after {
    font-family: 'Material Symbols Outlined';
    font-size: var(--icon-size-md);
    line-height: 1;
    vertical-align: middle;
}

#treediv td:has(> img[src$="folder.png"])::after,
#treediv td:has(> img[src$="fndoc.png"])::after,
#treediv td:has(> img[src$="folder_disabled.png"])::after {
    content: 'folder';
    color: var(--icon-color-secondary);
    font-variation-settings: 'FILL' 1;
}

#treediv td:has(> img[src$="folder_disabled.png"])::after {
    color: var(--text-tertiary);
}

#treediv td:has(> img[src$="inbox.png"])::after {
    content: 'inbox';
    color: var(--icon-color-secondary);
    font-variation-settings: 'FILL' 1;
}

#treediv td:has(> img[src$="trashcan.png"])::after {
    content: 'delete';
    color: var(--icon-color-secondary);
    font-variation-settings: 'FILL' 1;
}

/* Centred over the transparent image rather than beside it, so the cell keeps one
   icon's width, and transparent to pointers so the image below takes the click. */
#treediv td:has(> img.tafelTreeopenable[src*="minus"])::after,
#treediv td:has(> img.tafelTreeopenable[src*="plus"])::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--text-tertiary);
}

#treediv td:has(> img.tafelTreeopenable[src*="minus"])::after {
    content: 'expand_more';
}

#treediv td:has(> img.tafelTreeopenable[src*="plus"])::after {
    content: 'chevron_right';
}

/* A label-beside-field row in the archive modals, which open at a fixed height. */
.archive_modal_row {
    align-items: center;
}

.archive_modal_row > .app-form__label {
    flex: 0 0 8rem;
}

/* Used space. The bar was a row of PNG slices from Progressbar_4ds, which nothing else in the
   tree used; a <progress> carries the same meaning with no images and no inline width. */
.archive_space_block {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-secondary);
}

.archive_space_bar {
    appearance: none;
    display: block;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.archive_space_bar::-webkit-progress-bar {
    background: var(--bg-tertiary);
    border-radius: 999px;
}

.archive_space_bar::-webkit-progress-value {
    background: var(--success, #16a34a);
    border-radius: 999px;
}

.archive_space_bar::-moz-progress-bar {
    background: var(--success, #16a34a);
    border-radius: 999px;
}

.archive_space_bar--high::-webkit-progress-value { background: var(--yellow-500, #eab308); }
.archive_space_bar--high::-moz-progress-bar      { background: var(--yellow-500, #eab308); }
.archive_space_bar--full::-webkit-progress-value { background: var(--red-500, #dc2626); }
.archive_space_bar--full::-moz-progress-bar      { background: var(--red-500, #dc2626); }

/* Four action icons in a row read as one group, so they sit closer than the table's default cell
   padding of 10px a side would put them. */
#file_list_a td.novus_table_actions,
#file_list_a th.app-col--hug {
    padding-inline: var(--spacing-xs);
}

/* Rename sits at the end of the path, as an action on the folder you are looking at rather than a
   button parked at the bottom of the page. A 32px box beside an 18px heading, with the glyph at
   the same size as the file icons in the list. */
.archive_crumb_action.app-btn {
    --btn-h: 32px;
    width: 32px;
}

.archive_crumb_action .sym {
    font-size: var(--icon-size-md);
}

/* Emptying the trash is destructive and only reachable from the trash itself, so it sits beside
   that breadcrumb rather than in a toolbar every folder shows — in the place the rename control
   takes in every other folder. */
.archive_trash_action.app-btn {
    margin-left: var(--spacing-md);
}

/* The selected folder reads like the sidebar's active sub-item (accent text, no fill, over TafelTree's
   #eeeeff and bold in stylesheets/tree.css), so only hover gets the tint. */
#treediv .tafelTreeselected {
    background-color: transparent;
    color: var(--accent);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
    padding: 0 var(--spacing-xs);
}

#treediv .tafelTreecontent:hover {
    background-color: var(--color-hover-bg);
    border-radius: var(--radius-sm);
}

/* The action icons were halved to 4px apart, which also pulled the last one to 4px from the
   table's edge while every row still starts 10px in. The outer edge keeps the row's own inset. */
#archive_main_filelist .novus_list_table tr > :last-child ,
#archive_fndoc_filelist .novus_list_table tr > :last-child {
    padding-right: var(--spacing-md);
}

/* File-type colour, the way Drive reads a list: the four families people recognise by hue, plus
   video, all from the existing palette. Everything else keeps the list's own icon colour rather
   than getting a hue invented for it. The glyphs are filled, like the folder above them. */
.archive_file_icon--pdf,
.archive_file_icon--video {
    color: var(--red-500);
}

.archive_file_icon--doc {
    color: var(--blue-500);
}

.archive_file_icon--sheet {
    color: var(--green-600);
}

.archive_file_icon--slides {
    color: var(--yellow-500);
}

/* The image preview modal: the viewer centres its image, and the rotate control sits on top of it,
   which is what the fieldset's position: relative used to provide. */
.archive_image_viewer {
    position: relative;
    text-align: center;
}

/* The detail page's header block: the file's own icon beside the record, with the due-date list
   alongside it when the file carries one. */
.archive_detail_head {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

/* An inline data list pushes its value to the right edge, so an uncapped list throws the value
   half a screen from its label. */
.archive_detail_head > .app-data-list {
    flex: 1 1 20rem;
    max-width: 34rem;
    min-width: 0;
}

.archive_detail_icon {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.archive_detail_icon .sym.archive_file_icon {
    font-size: var(--icon-size-xl);
}

