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

.aw-vault-badge {
    display: inline-block;
    min-width: 44px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    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;
}

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

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

.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;
}

.aw-vault-thumb {
    display: block;
    width: 48px;
    /* 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: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f4f4f5;
}

/* 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 checkbox is a flex item inside the card body, so its
   uk-float-right is ignored - align-self restores the top-right spot. */
.aw-vault-card .uk-card-body .aw-vault-check {
    align-self: flex-end;
}

.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";
}

/* 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% - 90px);
    }

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

    .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;
}

/* 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;
}
