/**
 * BrandSync Vault - frontend table styles.
 * Kept light: layout and buttons come from UIkit / the active theme.
 */

.aw-vault-badge {
    display: inline-block;
    min-width: 56px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
    background: #e5e5e5;
    color: #333;
}

.aw-vault-badge[data-ext="pdf"] { background: #fde8e8; color: #c0392b; }
.aw-vault-badge[data-ext="doc"],
.aw-vault-badge[data-ext="docx"] { background: #e3edfb; color: #1f5fa8; }
.aw-vault-badge[data-ext="xls"],
.aw-vault-badge[data-ext="xlsx"],
.aw-vault-badge[data-ext="csv"] { background: #e2f3e8; color: #1e7c45; }
.aw-vault-badge[data-ext="ppt"],
.aw-vault-badge[data-ext="pptx"] { background: #fcebe0; color: #c2571b; }
.aw-vault-badge[data-ext="zip"] { background: #f0e8fb; color: #6d3fa8; }
.aw-vault-badge[data-ext="png"],
.aw-vault-badge[data-ext="jpg"],
.aw-vault-badge[data-ext="jpeg"],
.aw-vault-badge[data-ext="webp"],
.aw-vault-badge[data-ext="gif"],
.aw-vault-badge[data-ext="svg"],
.aw-vault-badge[data-ext="eps"],
.aw-vault-badge[data-ext="ai"] { background: #e8f4f8; color: #22778e; }

.aw-vault .aw-vault-row.aw-vault-hidden {
    display: none;
}

.aw-vault .aw-vault-zip[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Breathing room between the Download Selected buttons and the table. The
   top copy collapses entirely until a selection exists. */
.aw-vault .aw-vault-zip-top {
    margin: 4px 0 16px;
}

.aw-vault .aw-vault-zip-top[hidden] {
    display: none;
}

/* Cross-page selection prompt bar (Gmail pattern). */
.aw-vault-selectall-note {
    padding: 8px 14px;
    margin: 4px 0 14px;
    border-radius: 6px;
    background: #eef4fb;
    color: #33475b;
    font-size: 14px;
}

.aw-vault-selectall-note[hidden] {
    display: none;
}

.aw-vault-selectall-note .uk-button-text {
    margin-left: 10px;
    font-size: 14px;
}

.aw-vault .aw-vault-zip-bottom {
    margin-top: 16px;
}

.aw-vault .aw-vault-actions {
    white-space: nowrap;
}

.aw-vault .aw-vault-actions .aw-vault-ack,
.aw-vault .aw-vault-actions .aw-vault-chip,
.aw-vault .aw-vault-actions .aw-vault-dl {
    margin-left: 6px;
}

.aw-vault .aw-vault-dl:focus-visible {
    outline: 2px solid #1e5fa8;
    outline-offset: 2px;
}

.aw-vault-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.aw-vault-chip-done {
    background: #e2f3e8;
    color: #1e7c45;
}

.aw-vault-chip-pending {
    background: #fdf3e0;
    color: #9a6a12;
}

/* Past-review warning on rows/cards ("may be out of date"). */
.aw-vault-chip-review {
    background: #fdf3e0;
    color: #9a6a12;
    vertical-align: 1px;
}

/* Review date column: solid badge so the state jumps out - red once
   passed, amber-gold when review is within 30 days. White text needs
   the "yellow" darkened to gold or it fails contrast. */
.aw-vault-review-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.aw-vault .aw-vault-review-over .aw-vault-review-badge {
    background: #c0392b;
}

.aw-vault .aw-vault-review-soon .aw-vault-review-badge {
    background: #b7791f;
}

.aw-vault-thumb {
    display: block;
    width: 60px;
    /* min-width breaks the uk-table-shrink collapse: an unloaded (or
       filtered-in) lazy image has no intrinsic width, the shrink column
       collapses to 1px and UIkit's img max-width:100% pins the thumb
       there permanently. min-width wins over max-width. */
    min-width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    background: #f4f4f5;
}

/* Bundled filetype icons: thumbnail-sized in tables, larger in card media. */
.aw-vault-fileicon {
    display: block;
    width: 60px;
    min-width: 60px;
    height: 60px;
}

.aw-vault-card-media .aw-vault-fileicon {
    width: 96px;
    height: 96px;
    min-width: 0;
}

/* Category filter select inside the table heading. */
.aw-vault-cat-filter {
    font: inherit;
    font-weight: inherit;
    color: inherit;
    border: 1px solid #d5d5d8;
    border-radius: 4px;
    background: transparent;
    padding: 2px 6px;
    max-width: 160px;
    cursor: pointer;
}

.aw-vault-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 170px;
    overflow: hidden;
    background: #f7f7f8;
    border-radius: 6px 6px 0 0;
}

.aw-vault-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.aw-vault-card-media .aw-vault-badge {
    font-size: 15px;
    padding: 8px 14px;
}

.aw-vault-grid .aw-vault-card {
    height: 100%;
}

.aw-vault-grid .aw-vault-actions {
    white-space: normal;
}

.aw-vault-page-preview {
    max-width: 100%;
    max-height: 420px;
    border-radius: 8px;
    background: #f7f7f8;
}

.aw-vault-office-viewer {
    width: 100%;
    height: 480px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.aw-vault-switch .uk-active {
    background: #333;
    color: #fff;
}

.aw-vault-toolbar {
    gap: 14px 20px;
    margin-bottom: 14px;
}

.aw-vault-pills {
    gap: 8px;
    margin-top: 2px;
    margin-bottom: 20px;
}

.aw-vault-pills .aw-vault-filter-label {
    margin-right: 8px;
}

/* Cards: equal height with the action button pinned to the bottom. */
.aw-vault-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.aw-vault-card .uk-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.aw-vault-card .aw-vault-actions {
    /* !important: UIkit margin utilities (uk-margin-small-top) are
       !important themselves and would re-break the bottom pin. */
    margin-top: auto !important;
    padding-top: 12px;
}

/* The basket control is a flex item inside the card body - pin the
   labelled "Select" checkbox to the top-left of the card. */
.aw-vault-card .uk-card-body .aw-vault-card-select {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: -6px;
    margin-bottom: 2px;
}

.aw-vault-card .uk-card-body .aw-vault-card-select .uk-checkbox {
    margin-top: 0;
}

.aw-th-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Sortable column headers: plain-looking buttons with direction arrows. */
.aw-vault-th-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.aw-vault-th-btn:hover {
    text-decoration: underline;
}

th[aria-sort] .aw-vault-th-btn::after {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
}

th[aria-sort="ascending"] .aw-vault-th-btn::after {
    content: "\25B2";
}

th[aria-sort="descending"] .aw-vault-th-btn::after {
    content: "\25BC";
}

/* Tag pills row: pull up towards the type pills when both rows render,
   so the filter rows read as one group. */
.aw-vault-pills + .aw-vault-tag-pills {
    margin-top: -8px;
}

/* Format sub-pills (JPG / PNG / SVG) sit slightly apart from the groups. */
.aw-vault-pill-ext {
    font-size: 12px;
    padding: 2px 10px;
    border-style: dashed;
}

.aw-vault-pill-ext:first-of-type {
    margin-left: 10px;
}

.aw-vault-pager {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 4px;
}

.aw-vault-pager .aw-vault-pageinfo {
    font-size: 13px;
    color: #6b6b70;
    min-width: 90px;
    text-align: center;
}

.aw-vault-pager .aw-vault-per-label {
    margin-left: 10px;
}

/* Compact stacked table on small screens: checkbox pinned top-left,
   thumbnail beside the title, meta values as one inline row - instead of
   every cell taking a full-height line of its own. */
@media (max-width: 959px) {
    .aw-vault .aw-vault-stack tbody tr {
        position: relative;
        padding: 14px 0;
    }

    .aw-vault .aw-vault-stack tr .aw-td-check {
        position: absolute;
        top: 16px;
        left: 0;
        width: auto;
        padding: 0;
        margin: 0;
    }

    .aw-vault .aw-vault-stack tr .aw-td-media {
        display: inline-block;
        width: auto;
        vertical-align: top;
        padding-right: 10px;
    }

    .aw-vault .aw-vault-stack tr .aw-td-check ~ .aw-td-media {
        margin-left: 32px;
    }

    .aw-vault .aw-vault-stack tr .aw-td-title {
        display: inline-block;
        vertical-align: top;
        width: calc(100% - 102px);
    }

    .aw-vault .aw-vault-stack tr .aw-td-check ~ .aw-td-title {
        width: calc(100% - 134px);
    }

    .aw-vault .aw-vault-stack tr .aw-td-meta {
        display: inline-block;
        width: auto;
        margin: 6px 16px 0 0;
        font-size: 13px;
        color: #6b6b70;
        white-space: nowrap;
    }

    .aw-vault .aw-vault-stack tr .aw-vault-actions {
        display: block;
        width: 100%;
        margin-top: 10px;
        white-space: normal;
    }
}

.aw-vault-search-wrap {
    width: 240px;
    max-width: 100%;
}

.aw-vault-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.aw-vault-filter-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64646b; /* >= 4.5:1 on white (WCAG AA) */
    margin-right: 4px;
    white-space: nowrap;
}

/* Pack sign-off panel on collection pages. */
.aw-pack-panel {
    border-left: 4px solid #1e5fa8;
}

.aw-pack-panel .aw-pack-ack-btn:focus-visible {
    outline: 2px solid #1e5fa8;
    outline-offset: 2px;
}

/* WCAG 2.4.7: keyboard focus must be visible even when themes strip
   default outlines. */
.aw-vault .aw-vault-pill:focus-visible,
.aw-vault .aw-vault-ack:focus-visible,
.aw-vault .aw-vault-switch-btn:focus-visible,
.aw-vault .aw-vault-search-icon:focus-visible,
.aw-vault .aw-vault-check:focus-visible,
.aw-vault .aw-vault-check-all:focus-visible,
.aw-vault .aw-vault-zip:focus-visible {
    outline: 2px solid #1e5fa8;
    outline-offset: 2px;
}

.aw-vault-search-icon {
    background: none;
    border: 0;
    cursor: pointer;
}

.aw-vault-date-wrap {
    gap: 8px;
}

.aw-vault-pill {
    border: 1px solid #d5d5d8;
    background: #fff;
    color: #444;
    border-radius: 999px;
    padding: 3px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.aw-vault-pill:hover {
    border-color: #999;
}

.aw-vault-pill.uk-active {
    background: #333;
    border-color: #333;
    color: #fff;
}

/* Theme-independent colour options. Some YOOtheme styles compile the
   UIkit text utilities (emphasis / muted) to white-ish values with
   !important, which made the colour dropdowns useless - these fixed
   colours win over any theme. Primary intentionally stays the theme's
   brand colour (uk-text-primary). White is for dark heading bands. */
.aw-vault .aw-color-emphasis,
.aw-vault table.aw-color-emphasis td {
    color: #333 !important;
}

.aw-vault .aw-color-muted,
.aw-vault table.aw-color-muted td {
    color: #8a8a90 !important;
}

.aw-vault .aw-color-white,
.aw-vault table.aw-color-white td {
    color: #fff !important;
}

/* Vertical 1px dividers between table columns. Switched off in the
   stacked mobile layout, where cells flow as inline blocks. */
.aw-vault table th + th,
.aw-vault table td + td {
    border-left: 1px solid #e5e5e5;
}

@media (max-width: 959px) {
    .aw-vault .aw-vault-stack tr th,
    .aw-vault .aw-vault-stack tr td {
        border-left: 0;
    }
}

/* Click-through cards wrap the media in a link: without sizing, the link
   shrink-wraps and the image's 100% sizing has nothing to resolve against,
   so previews rendered at their natural size and got cropped. */
.aw-vault-card-media > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Backend-chosen preview image: never cropped (custom icons must stay
   whole), icon-sized in cards, thumbnail-sized in tables. */
.aw-vault .aw-vault-thumb.aw-vault-override {
    object-fit: contain;
    background: transparent;
}

.aw-vault-card-media .aw-vault-override-card {
    width: auto;
    height: auto;
    max-width: 80%;
    max-height: 120px;
    object-fit: contain;
}

.aw-vault-page-preview.aw-vault-override-page {
    max-height: 200px;
}

/* Hub search box styling options: optional visible Search button beside
   the input, optional theme-coloured panel around the whole thing. */
.aw-hub-search-row .aw-hub-search-btn {
    margin-left: 10px;
    white-space: nowrap;
}

.aw-hub-search-panel {
    margin-bottom: 4px;
}

.aw-hub-search-panel .uk-form-icon {
    color: inherit;
}

/* ------------------------------------------------------------------
 * 0.27.1 - theme-independent basket checkboxes.
 * Some YOOtheme styles compile .uk-checkbox for a dark background
 * (translucent white box, no border, white tick) which is invisible on a
 * light table. Own box + tick, same on every theme; the existing
 * :focus-visible rule above still applies.
 * ------------------------------------------------------------------ */
.aw-vault .aw-vault-check,
.aw-vault .aw-vault-check-all {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 2px solid #8a8a90;
    border-radius: 3px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
    vertical-align: middle;
    cursor: pointer;
    flex: none;
    transition: border-color .1s, background-color .1s;
}

.aw-vault .aw-vault-check:hover,
.aw-vault .aw-vault-check-all:hover {
    border-color: #333;
}

.aw-vault .aw-vault-check:checked,
.aw-vault .aw-vault-check-all:checked,
.aw-vault .aw-vault-check-all:indeterminate {
    background-color: #333;
    border-color: #333;
}

.aw-vault .aw-vault-check:checked,
.aw-vault .aw-vault-check-all:checked {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><polyline fill='none' stroke='%23fff' stroke-width='2' points='1.5,6.5 4.5,9.5 10.5,3'/></svg>");
}

.aw-vault .aw-vault-check-all:indeterminate {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><line stroke='%23fff' stroke-width='2' x1='2' y1='6' x2='10' y2='6'/></svg>");
}

.aw-vault .aw-vault-check:disabled,
.aw-vault .aw-vault-check-all:disabled {
    opacity: .5;
    cursor: default;
}

/* ------------------------------------------------------------------
 * 0.27.1 - "Light" card style (card_style=light / card="light").
 * Fixed white card with border, soft shadow and dark text, for themes
 * whose uk-card-default is compiled for a dark background.
 * ------------------------------------------------------------------ */
.aw-vault .aw-vault-card.aw-vault-card-light {
    background: #fff;
    border: 1px solid #e3e3e6;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    color: #333;
}

.aw-vault .aw-vault-card.aw-vault-card-light .uk-card-body {
    color: #333;
}

.aw-vault .aw-vault-card.aw-vault-card-light .uk-text-meta,
.aw-vault .aw-vault-card.aw-vault-card-light .aw-vault-card-select {
    color: #8a8a90;
}

.aw-vault .aw-vault-card.aw-vault-card-light .aw-vault-card-media {
    background: #f2f2f4;
    border-bottom: 1px solid #ececef;
}

.aw-vault .aw-vault-card.aw-vault-card-light.uk-card-hover:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    transform: translateY(-2px);
}
