/* ===========================================
   CKAN Icon Fix - Memperkecil Icon Besar
   Untuk: satudata.mempawahkab.go.id
   
   Tambahkan CSS ini ke:
   /srv/app/src/ckan/ckan/public/base/css/
   atau di custom theme CSS
   =========================================== */

/* ============================================
   1. HIDE/RESIZE DEFAULT CKAN LARGE ICONS
   ============================================ */

/* Hide default CKAN large preview icons in resource list */
.resource-list > li > .ckan-icon,
.resource-list > li > svg:not(.resource-btn-modern svg):not([width="16"]):not([width="18"]):not([width="20"]):not([width="24"]),
.resource-list > li > a > svg:not(.resource-btn-modern svg):not([width="16"]):not([width="18"]):not([width="20"]):not([width="24"]),
ul.resource-list > li > svg[width="200"],
ul.resource-list > li > svg[height="200"],
.resource-list .icon-download:not(.btn .icon-download),
.resource-list .icon-eye-open:not(.btn .icon-eye-open),
.resource-list .icon-eye:not(.btn .icon-eye) {
    display: none !important;
}

/* Force max size for any remaining large icons */
.resource-list svg,
.resource-item svg,
.package-resources svg,
#content .resource-list svg,
.primary .resource-list svg {
    max-width: 24px !important;
    max-height: 24px !important;
}

/* ============================================
   2. FIX RESOURCE READ PAGE ICONS
   ============================================ */

/* Resource view/preview placeholder icons */
.resource-view svg:not(.btn svg):not(.actions svg):not([width="16"]):not([width="18"]):not([width="20"]):not([width="24"]),
.ckanext-datapreview svg:not(.btn svg),
.data-viewer-info svg,
.data-viewer-error svg,
.resource-preview svg:not(.btn svg) {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
}

/* Empty state container */
.resource-view .empty,
.ckanext-datapreview .empty,
.resource-preview .empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    min-height: 100px !important;
    max-height: 200px !important;
}

/* ============================================
   3. PRESERVE SMALL BUTTON ICONS
   ============================================ */

/* Keep button icons small */
.btn svg,
.btn-group svg,
.actions svg,
.resource-action-btn svg,
.resource-btn-modern svg,
.nav-tabs svg,
a.btn svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    display: inline-block !important;
}

/* Header icons slightly bigger */
h1 svg, h2 svg, h3 svg,
.module-heading svg,
.section-heading svg {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
}

/* ============================================
   4. FORMAT LABEL ICONS
   ============================================ */

.format-label svg,
.resource-format svg,
.format-icon svg {
    width: 14px !important;
    height: 14px !important;
}

/* ============================================
   5. OVERRIDE DEFAULT CKAN ICON STYLES
   ============================================ */

/* Remove any inline styles that might override */
.resource-list > li svg[style*="width"],
.resource-list > li svg[style*="height"],
.resource-list svg[viewBox] {
    width: 20px !important;
    height: 20px !important;
}

/* Hide background icons */
.resource-list > li::before,
.resource-list > li::after {
    background-image: none !important;
    content: none !important;
}

/* ============================================
   6. THUMBNAIL/PREVIEW IMAGE SIZING
   ============================================ */

.resource-thumbnail,
.resource-icon,
.resource-format-icon,
.format-icon {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain;
}

/* ============================================
   7. ULTRA SPECIFIC SELECTORS (Last Resort)
   ============================================ */

/* Target any SVG larger than 100px */
body svg[width="100"],
body svg[width="150"],
body svg[width="200"],
body svg[width="300"],
body svg[height="100"],
body svg[height="150"],
body svg[height="200"],
body svg[height="300"],
#content svg[width="100"],
#content svg[width="150"],
#content svg[width="200"],
#content svg[height="100"],
#content svg[height="150"],
#content svg[height="200"] {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
}

/* Icon color to match theme */
.resource-list svg,
.resource-view svg {
    color: #2a7c9c;
    fill: currentColor;
}
