/* =========================================
   Curator Standalone Fix (Final)
   ========================================= */

/* --- 1. Modal Picker Grid Fix --- */
.curator-panel .curator-picker-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1rem !important;
}
@media (min-width: 640px) {
    .curator-panel .curator-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (min-width: 768px) {
    .curator-panel .curator-picker-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}
@media (min-width: 1280px) {
    .curator-panel .curator-picker-grid { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; }
}
@media (min-width: 1536px) {
    .curator-panel .curator-picker-grid { grid-template-columns: repeat(10, minmax(0, 1fr)) !important; }
}
.curator-panel .curator-picker-grid li.aspect-square {
    aspect-ratio: 1 / 1;
}

/* --- 2. Form Preview Grid Fix (.curator-grid-container) --- */
.curator-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem; 
    width: 100%;
}
@media (min-width: 768px) {
    .curator-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
.curator-grid-container li {
    display: block;
    width: 100%;
    position: relative;
}

/* --- 3. Resource Index Table Fix (.fi-ta-content-grid) --- */
/* Target the record wrapper directly to prevent collapsing */
.fi-ta-content-grid .fi-ta-record:has(.curator-grid-column) {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important; /* Force aspect ratio so absolute child fits */
}

/* Ensure the inner column fills the record */
.curator-grid-column {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Image cover */
.curator-grid-column img {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
}

/* Actions overlay positioning */
.fi-ta-content-grid .fi-ta-record .fi-ta-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 0.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    pointer-events: auto; /* Ensure clicks work */
}

/* Selection ring */
.fi-ta-content-grid .fi-ta-record:has([type="checkbox"]:checked) {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 1); /* primary-500 fallback */
    border-radius: 0.75rem; /* rounded-xl matches curator-grid-column */
}

/* --- 4. Utilities --- */
.checkered {
    background-color: #e5e7eb;
    background-image: 
        repeating-linear-gradient(45deg, #d1d5db 25%, transparent 25%, transparent 75%, #d1d5db 75%, #d1d5db), 
        repeating-linear-gradient(45deg, #d1d5db 25%, #e5e7eb 25%, #e5e7eb 75%, #d1d5db 75%, #d1d5db);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
}
.dark .checkered {
    background-color: #1f2937;
    background-image: 
        repeating-linear-gradient(45deg, #374151 25%, transparent 25%, transparent 75%, #374151 75%, #374151), 
        repeating-linear-gradient(45deg, #374151 25%, #1f2937 25%, #1f2937 75%, #374151 75%, #374151);
}
.curator-panel .filepond--panel {
    border: 2px dashed rgba(0, 0, 0, 0.1);
    background-color: transparent;
}
.dark .curator-panel .filepond--panel {
    border-color: rgba(255, 255, 255, 0.2);
}
