/* ==========================================================================
   DEA workspace extracted from dea.ejs
   ========================================================================== */

.main-content {
    transition: none;
    padding: 20px 16px;
    margin-left: var(--content-offset-desktop);
    width: calc(100vw - var(--content-offset-desktop));
    max-width: calc(100vw - var(--content-offset-desktop));
}
.embeding-box {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* DEA plot containers + legends */
.dea-plot-section {
    margin: 12px 0 24px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.dea-plot-title {
    font-weight: 600;
    margin: 4px 0 8px;
}
.dea-plot-legend {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-label { font-size: 13px; color: #374151; }
.legend-gradient {
    width: 180px;
    height: 10px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}
.legend-gradient-reds {
    /* Approximate Plotly Reds continuous scale */
    background: linear-gradient(to right,
        #fff5f0, #fee0d2, #fcbba1, #fc9272,
        #fb6a4a, #ef3b2c, #cb181d, #99000d
    );
}
.legend-gradient-diverging {
    /* Approximate Plotly 'balance' (blue → white → red) */
    background: linear-gradient(to right,
        #313695, #7aa6d9, #c5d9f2, #ffffff,
        #f0b0a8, #de6e68, #a50026
    );
}
.legend-ticks { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; }
.size-legend { display: flex; align-items: center; gap: 12px; }
.size-dot { display: inline-block; border-radius: 50%; background: #6b7280; opacity: 0.6; border: 1px solid #4b5563; }
.size-dot-sm { width: 5px; height: 5px; }
.size-dot-md { width: 9px; height: 9px; }
.size-dot-lg { width: 13px; height: 13px; }
.plot-frame { width: 100%; height: min(58vh, 560px); min-height: 416px; border: none; margin-top: 10px; }
.dea-plot-frame {
    display: block;
    box-sizing: border-box;
}
body.dea-shell iframe.dea-plot-frame {
    border: 0;
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: -1px;
    border-radius: 12px;
    background: #ffffff;
}
.dea-plot-image {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    max-height: 520px;
    margin-top: 10px;
    border: 0;
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: -1px;
    border-radius: 12px;
    background: #ffffff;
    object-fit: contain;
}
/* CSV tabs layout inside the overlay */
#tableOverlay .tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: 100%;
}
#tableOverlay .tab-links { flex: 0 0 auto; margin: 0; padding: 6px 0; }
#csvTabContent {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 420px;
    overflow: hidden;
}

/* Each pane actually fills the available space */
.csv-tab-pane { width: 100%; height: 100%; display: none; overflow: hidden; }
.csv-tab-pane.active { display: block; }

.dea-tabulator-pane {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    min-width: min(800px, 100%);
    min-height: 420px;
    height: 100%;
    overflow: hidden;
}

.dea-tabulator-host {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

/* Let Tabulator manage its own height; don’t force 100% */
.csv-tab-pane .tabulator { width: 100% !important; /* remove any height:100% override */ }

/* Single-table overlay path */
#tableOverlay > div { height: 90vh; }
#tableOverlay .tabulator-container { height: calc(100% - 56px); }
#example-table { width: 100%; min-height: 420px; }

/* Keep gene selection area a simple layout now */
.gene-list-container {
    display: flex;
    gap: 16px;
    align-items: start;
    width: 100%;
}
.gene-list-container > div:first-child {
    flex: 1;
}

/* scExplorer polished DEA table overlay */
body.dea-shell #tableOverlay .dea-table-dialog {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    width: min(1180px, 94vw) !important;
    height: min(820px, 90vh) !important;
    padding: 0 !important;
    border-radius: 24px !important;
    background: #f7f9fc !important;
    overflow: hidden !important;
}

body.dea-shell #tableOverlay .tabulator-container {
    height: auto !important;
    min-height: 0 !important;
}

body.dea-shell #example-table {
    min-height: 0;
    height: 100%;
}

body.dea-shell .dea-table-scroll {
    padding: 14px;
    overflow: hidden;
}

body.dea-shell .dea-table-area {
    height: calc(100% - 62px);
    min-height: 0;
}

body.dea-shell .dea-tabulator-host {
    min-height: 0;
    height: 100%;
}
.gene-list-container .upload-gene-list-container {
    flex: 1;
}
#gene_options { 
    width: 100%; 
}
#selectedGenesContainer {
    border: 1px solid #e5e7eb;
    background: #fafafa;
    padding: 8px;
    border-radius: 8px;
    min-height: 44px;
    height: auto;
    overflow-y: visible;
    overflow-x: hidden;
    width: 100%;
}
/* Responsive fallback */
@media (max-width: 980px) {
    .gene-list-container {
        flex-direction: column;
    }
    #selectedGenesContainer { 
        max-width: 100%; 
    }
}
@media (max-width: 768px) {
    .main-content {
        padding: 12px;
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    .plot-frame {
        height: 320px !important;
        min-height: 320px !important;
    }
    .dea-plot-image {
        max-height: 320px;
    }
}
/* Ensure proper spacing for parameter rows */
