/* DAM Display element — grid + table styling.
 *
 * Rows/cards are server-rendered by the gap_dam_display_item child template,
 * which emits YooTheme-native markup:
 *   Grid card  : .el-card.uk-card > (a.el-card-link) > .el-media (+ .gap-ratio-*)
 *                > .el-image, and .el-content.uk-card-body > .el-title, .el-meta
 *   Table row  : <td class="gap-col-image|title|meta|link"> with .el-image inside
 * UIkit styles .uk-card/.uk-card-body; these rules only add media-fit, aspect
 * ratios, and the whole-card hover lift. */

/* Table + card thumbnails: fill their box, cover-cropped. */
.gap-dam-display .el-image {
    display: block;
    object-fit: cover;
}

.gap-dam-display .gap-col-image .el-image {
    width: 60px;
    height: 60px;
    border-radius: 3px;
}

/* Grid card media box */
.gap-dam-grid .el-card {
    width: 100%;
    overflow: hidden;
}

.gap-dam-grid .el-media {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.gap-dam-grid .el-media .el-image {
    width: 100%;
    height: 100%;
}

/* Fixed aspect-ratio media boxes (child template adds gap-ratio-<ratio>). */
.gap-dam-grid .gap-ratio-1-1 { aspect-ratio: 1 / 1; }
.gap-dam-grid .gap-ratio-4-3 { aspect-ratio: 4 / 3; }
.gap-dam-grid .gap-ratio-3-2 { aspect-ratio: 3 / 2; }
.gap-dam-grid .gap-ratio-16-9 { aspect-ratio: 16 / 9; }

.gap-dam-grid .el-title {
    line-height: 1.3;
}

.gap-dam-grid .el-meta {
    margin-top: 4px;
}

.gap-dam-grid .el-card-link:hover .el-card {
    box-shadow: 0 14px 25px rgba(0, 0, 0, 0.16);
    transition: box-shadow 0.1s ease-in-out;
}

/* Grid controls chrome (search / paging / info) */
.gap-dam-grid-controls {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gap-dam-grid-controls .dataTables_filter,
.gap-dam-grid-controls .dataTables_length {
    margin-bottom: 8px;
}

/* Searchable multi-select filter control */
.gap-ss {
    position: relative;
    display: inline-block;
    min-width: 180px;
}

.gap-ss-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    text-transform: none;
}

.gap-ss-toggle .gap-ss-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gap-ss.gap-ss-active > .gap-ss-toggle {
    border-color: var(--global-primary-background, #1e87f0);
    color: var(--global-primary-background, #1e87f0);
}

.gap-ss-caret {
    flex: 0 0 auto;
}

.gap-ss-dropdown {
    position: absolute;
    z-index: 1010;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-width: 320px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    padding: 8px;
}

.gap-ss-dropdown[hidden] {
    display: none;
}

.gap-ss-search {
    width: 100%;
    margin-bottom: 6px;
}

.gap-ss-options {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}

.gap-ss-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1.3;
}

.gap-ss-option label:hover {
    background: rgba(0, 0, 0, 0.04);
}

.gap-ss-empty {
    padding: 6px 4px;
}

/* Table text handling (parity with gap-ajax-table) */
.gap-text-nowrap td { white-space: nowrap; }
.gap-text-truncate td {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}
.gap-text-truncate-1 td { -webkit-line-clamp: 1; }
.gap-text-truncate-2 td { -webkit-line-clamp: 2; }
.gap-text-truncate-3 td { -webkit-line-clamp: 3; }

/* Filter cells: each exposed facet's <select> (created client-side from the
   server's cascading facets payload) sits in its own cell in the filter row. */
.gap-dam-filter-cell {
    min-width: 180px;
}

.gap-dam-filter-cell .gap-filter.uk-select {
    min-width: 180px;
}

/* Filter action buttons (explicit Search / Clear). Filters apply on click, not
   on every change, so the user builds a combined query and runs it deliberately. */
.gap-dam-filter-actions {
    display: flex;
    align-items: center;
}

/* Subtle cue that selections are not yet applied: pulse the Search button. */
.gap-dam-filters-dirty .gap-dam-filter-search {
    box-shadow: 0 0 0 0 rgba(30, 135, 240, 0.6);
    animation: gap-dam-search-pulse 1.6s ease-out infinite;
}

@keyframes gap-dam-search-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(30, 135, 240, 0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(30, 135, 240, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 135, 240, 0); }
}
