/* Central image-management presentation shared by support, products and native upload cards. */
:root {
    --portal-image-card-width:160px;
    --portal-image-card-height:200px;
}

/* Shared upload tile: support attachments, product images and shipping images. */
.support-upload-pick,
button.dt-button.support-upload-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: var(--portal-image-card-width);
    min-width: 0;
    max-width: 100%;
    height: var(--portal-image-card-height);
    min-height: var(--portal-image-card-height);
    padding: 14px;
    box-sizing: border-box;
    border-radius: 18px;
    border: 1px dashed #9db4c8;
    border-style:dashed !important;
    background: #edf4fa;
    color: #17364f;
    cursor: pointer;
    justify-self: start;
    align-self: start;
    order: 999;
}

.support-upload-pick > span {
    font-size: 2.6rem;
    line-height: 1;
    color: #0f6798;
}

.support-upload-pick small {
    display: block;
    margin-top: 8px;
    color: #5f7285;
    font-size: 0.92rem;
}

/* Native Buttons keep the upload tile's visible label and support-style plus icon. */
button.dt-button.support-upload-pick::before,
button.dt-button.support-upload-pick:has(> span:not(:empty))::before {
    content:"+";
    font-family:inherit;
    font-weight:700;
    font-size:2.6rem;
    line-height:1;
    color:#0f6798;
    margin:0;
}
button.dt-button.support-upload-pick > span {
    position:static;
    width:auto;
    height:auto;
    overflow:visible;
    clip-path:none;
    display:block;
    margin-top:8px;
    color:#5f7285;
    font-size:0.92rem;
    line-height:normal;
}

/* Filled cards and the upload action share the same centrally defined footprint. */
.product-image-card,
.product-image-add-row .dt-buttons,
.portal-image-upload-card { width:var(--portal-image-card-width); max-width:100%; height:var(--portal-image-card-height); box-sizing:border-box; }
.product-image-card .arqiv-gr-card-preview { position: relative; width: 100%; height: 100%; box-sizing:border-box; overflow: hidden; border-radius: 8px; border: 1px solid var(--line, #ced4da); background: var(--bg, #f5f7fa); }
.product-image-card .arqiv-gr-card-preview > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; user-select: none; pointer-events: none; }
.product-image-card.is-primary .arqiv-gr-card-preview { box-shadow: 0 0 0 2px goldenrod; }
.product-image-card .arqiv-gr-order-badge { position: absolute; top: 8px; left: 8px; min-width: 24px; height: 24px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent, #17a1ae); color: #000; font-size: 12px; font-weight: 700; pointer-events: none; }
.product-image-card .arqiv-gr-image-view-badge { position: absolute; bottom: 8px; left: 8px; max-width: 100px; padding: 4px 6px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; pointer-events: none; }
.product-image-card-actions { position: absolute; bottom: 8px; right: 8px; }
.product-image-card-actions .dt-buttons { display: flex; flex-direction: column; gap: 8px; }
.product-image-card-actions button.dt-button { width: 38px; min-width: 38px; height: 38px; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.product-image-card-actions button.dt-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Hidden accessible labels must not trigger the shared spacing for visible button text. */
.product-image-card-actions button.dt-button::before,
.product-image-card-actions button.dt-button:has(> span:not(:empty))::before { margin: 0; line-height: 1; }
.product-image-card-actions .dt-button-view::before { content: "\f00e"; }
.product-image-card-actions .dt-button-refresh::before { content: "\f2f9"; }
.product-image-add-row .dt-buttons { display: flex; }

/* Single-image fields use the native Editor upload lifecycle with the same gallery card surface. */
.portal-image-upload-field .editor_upload { display:none; }
.portal-image-upload-field .product-image-card-actions .dt-button-edit::before { content:"\f013"; }
.portal-image-upload-field .portal-image-upload-card[aria-busy=true] { opacity:.6; pointer-events:none; }

/* Shared attachment cards, extracted from support ticket attachments. */
.admin-support-attachments-library {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 190px));
}

.admin-support-attachment-card {
    display: grid;
    min-width: 0;
    gap: 10px;
    align-content: start;
}

.admin-support-attachment-media {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 120px;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 18px;
    border: 1px solid #d6e0ea;
    background: #f5f8fb;
    overflow: hidden;
}

.admin-support-attachment-media img {
    width: 100%;
    height: 100%;
    max-height: 100px;
    object-fit: cover;
    border-radius: 12px;
}

.admin-support-attachment-media img.admin-support-lightbox-trigger {
    cursor: zoom-in;
}

.admin-support-attachment-file-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100px;
    border-radius: 14px;
    background: #edf4fa;
    color: #0f6798;
    font-size: 2rem;
}

.admin-support-attachment-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 2;
}

.admin-support-attachment-action {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 100, 176, 0.92);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(8, 25, 43, 0.24);
}

.admin-support-attachment-action:hover,
.admin-support-attachment-action:focus {
    background: rgba(9, 76, 133, 0.96);
    color: #fff;
}

.admin-support-attachment-action.is-delete {
    background: rgba(150, 34, 34, 0.92);
}

.admin-support-attachment-action.is-delete:hover,
.admin-support-attachment-action.is-delete:focus {
    background: rgba(116, 22, 22, 0.96);
}

.admin-support-attachment-details {
    display: grid;
    min-width: 0;
    gap: 4px;
    color: #17364f;
}

.admin-support-attachment-name {
    min-width: 0;
    font-weight: 600;
    line-height: 1.35;
}

.admin-support-attachment-name a,
.admin-support-attachment-filename {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-support-attachment-meta {
    min-width: 0;
    color: #5f7285;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: normal;
    word-break: normal;
}


/* A native Editor multi-select table retains selection and paging while presenting file cards. */
.attachment-card-table tbody { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),190px)); gap:20px; }
.attachment-card-table tbody tr { display:block; min-width:0; border-radius:18px; }
.attachment-card-table tbody td { display:block; box-sizing:border-box; }
.attachment-card-table tbody tr.selected { outline:2px solid var(--accent,#17a1ae); }
.attachment-card-table .admin-support-attachment-name { white-space:normal; }
html.dark .admin-support-attachment-meta,
html[data-bs-theme=dark] .admin-support-attachment-meta { color:#c7d3de; }

/* Shared attachment-action icon uses the portal's standard button icon convention. */
.dt-button-attachment::before { font-family:"Font Awesome 5 Free"; font-weight:900; content:"\f0c6"; color:inherit; margin-right:.35em; }

/* Native Editor tables keep the same upload-tile footprint as support attachments. */
div.DTE_Field_Type_datatable button.dt-button.support-upload-pick { width:var(--portal-image-card-width); }
.attachment-card-table tbody td { border:0 !important; box-shadow:none !important; padding:8px !important; }

/* File cards shared by support attachments and the central attachment library. */
.support-upload-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 140px));
    justify-content: start;
    justify-items: start;
}

.support-upload-files {
    display: contents;
}

.support-upload-card {
    display: grid;
    gap: 8px;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    min-height: 160px;
    padding: 14px;
    box-sizing: border-box;
    border-radius: 18px;
    border: 1px solid #d6e0ea;
    background: #f5f8fb;
}

.support-upload-preview,
.support-upload-file-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    border-radius: 14px;
    background: #edf4fa;
    overflow: hidden;
}

.support-upload-preview img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
}

.support-upload-file-badge {
    color: #0f6798;
    font-size: 2rem;
}

.support-upload-card-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.support-upload-card-name {
    font-weight: 600;
    word-break: break-word;
}

.support-upload-card-meta,
.support-upload-card-status {
    color: #5f7285;
    font-size: 0.92rem;
}

.support-upload-card-remove {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #eef3f8;
    color: #17364f;
    cursor: pointer;
}

.support-upload-card-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce6ef;
}

.support-upload-card-progress > span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #0f6798 0%, #22a06b 100%);
}


/* Editor owns the input, file value, drop handling and preview. Only presentation changes here. */
div.DTE .portal-attachment-upload-field .editor_upload,
div.DTE .portal-attachment-upload-field .editor_upload .eu_table,
div.DTE .portal-attachment-upload-field .editor_upload .row,
div.DTE .portal-attachment-upload-field .editor_upload .cell,
div.DTE .portal-attachment-upload-field .editor_upload .rendered { display:contents; }
div.DTE .portal-attachment-upload-field .editor_upload .cell.upload,
div.DTE .portal-attachment-upload-field .editor_upload .clearValue,
div.DTE .portal-attachment-upload-field .editor_upload .rendered > span { display:none; }
div.DTE .portal-attachment-upload-field .editor_upload .drop { display:none; }
