/* --- Production UI Restore v20 --- */

/* 1. Repeater & Dropdown Harmony */
/* We allow overflow visible so dropdowns don't get cut off */
.fi-fo-table-repeater {
    overflow: visible !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    position: relative;
}

.fi-fo-table-repeater > table {
    min-width: 900px !important;
    margin-bottom: 25px !important; /* The precise gap */
}

/* Force cells to show dropdowns */
.fi-fo-table-repeater td, 
.fi-fo-table-repeater tr {
    overflow: visible !important;
}

/* 2. Dropdown Styling & Depth */
.fi-dropdown-panel {
    background-color: #18181b !important;
    border: 1px solid #3f3f46 !important;
    z-index: 99999 !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
}

/* 3. Summary Row Fix */
.fi-ta-summary-row, .fi-ta-summary-header-row {
    background-color: #f3f4f6 !important;
}
.dark .fi-ta-summary-row, .dark .fi-ta-summary-header-row {
    background-color: #27272a !important;
}

/* 4. Natural Scrolling */
html, body {
    overflow-x: visible !important;
}

/* --- Production UI Refinement: Sticky Scroll & Responsive Grids --- */

/* 5. Sticky Horizontal Scrollbar Fix */
/* Target Filament table content wrapper to ensure scrollbar is reachable */
.fi-ta-content {
    position: relative;
    overflow-x: auto !important;
}

/* Forcing the scrollbar to be more prominent and accessible */
.fi-ta-content::-webkit-scrollbar {
    height: 12px;
}
.fi-ta-content::-webkit-scrollbar-track {
    background: transparent;
}
.fi-ta-content::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.4);
    border-radius: 6px;
    border: 3px solid transparent;
    background-clip: content-box;
}
.dark .fi-ta-content::-webkit-scrollbar-thumb {
    background-color: rgba(75, 85, 99, 0.6);
}

/* 6. Responsive Grid Fixes (Phone & Tablet) */
@media (max-width: 640px) {
    /* Phone: Force 1 column for all forms */
    .fi-fo-component-grid, 
    .fi-fo-field-set > .grid,
    .fi-fo-layout-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    
    /* Auto-collapse sidebar on mobile */
    .fi-sidebar {
        z-index: 50 !important;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    /* Tablet / Split Screen: Force 2 columns */
    .fi-fo-component-grid,
    .fi-fo-field-set > .grid,
    .fi-fo-layout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* 7. Table Header Stickiness (Production Ready) */
.fi-ta-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: inherit;
}
