/* Pivot Table workspace — styled for NTB Satu Data / Metronic */

.pivot-workspace {
    background: var(--bs-gray-100, #f5f8fa);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px dashed var(--bs-gray-300, #e4e6ef);
}

.pivot-workspace #pivot-output {
    min-height: 420px;
}

.pivot-workspace #pivot-output .pvtUi {
    width: 100%;
    color: var(--bs-gray-800, #3f4254);
    font-family: Inter, Helvetica, sans-serif;
}

/* Drag-and-drop field lists */
.pivot-workspace .pvtAxisContainer,
.pivot-workspace .pvtVals {
    background: #fff;
    border: 1px solid var(--bs-gray-200, #eff2f5);
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pivot-workspace .pvtAxisContainer li span.pvtAttr {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(30, 58, 95, 0.2);
}

.pivot-workspace .pvtAxisContainer li span.pvtAttr:hover {
    background: linear-gradient(135deg, #152a45 0%, #1e3a5f 100%);
}

.pivot-workspace .pvtFilteredAttribute {
    background: #fff8e6 !important;
    color: #b8860b !important;
}

/* Control bar: renderer & aggregator dropdowns */
.pivot-workspace .pvtUi select {
    border: 1px solid var(--bs-gray-300, #e4e6ef);
    border-radius: 0.425rem;
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #fff;
    color: var(--bs-gray-800, #3f4254);
    max-width: 100%;
}

.pivot-workspace .pvtUi td.pvtUiCell {
    padding: 0.35rem;
}

/* Result area */
.pivot-workspace .pvtRendererArea {
    background: #fff;
    border: 1px solid var(--bs-gray-200, #eff2f5);
    border-radius: 0.625rem;
    padding: 1rem;
    margin-top: 0.75rem;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.pivot-workspace table.pvtTable {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
    width: auto;
    min-width: 100%;
}

.pivot-workspace table.pvtTable thead tr th,
.pivot-workspace table.pvtTable tbody tr th {
    background: var(--bs-gray-100, #f5f8fa);
    color: var(--bs-gray-800, #3f4254);
    font-weight: 600;
    border: 1px solid var(--bs-gray-200, #eff2f5);
    padding: 0.5rem 0.75rem;
}

.pivot-workspace table.pvtTable tbody tr td {
    border: 1px solid var(--bs-gray-200, #eff2f5);
    padding: 0.45rem 0.75rem;
    color: var(--bs-gray-700, #5e6278);
}

.pivot-workspace table.pvtTable .pvtVal {
    text-align: right;
}

.pivot-workspace table.pvtTable .pvtTotal,
.pivot-workspace table.pvtTable .pvtGrandTotal {
    font-weight: 700;
    background: #eef3f9;
}

/* Heatmap cells */
.pivot-workspace .pvtHeatmap td {
    border-radius: 2px;
}

/* Inline table bar chart */
.pivot-workspace .pvtBarVisualizer {
    border-radius: 2px;
}

/* Plotly chart container */
.pivot-workspace .pvtRendererArea .js-plotly-plot {
    min-height: 400px;
    width: 100% !important;
}

.pivot-workspace .pvtRendererArea .plotly {
    margin: 0 auto;
}

/* Filter dropdowns (jQuery UI) */
.pivot-workspace .pvtFilterBox {
    border: 1px solid var(--bs-gray-200, #eff2f5);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background: #fff;
    z-index: 1050;
    max-width: 320px;
    padding: 0.75rem;
}

.pivot-workspace .pvtFilterBox h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.pivot-workspace .pvtFilterBox input[type="text"] {
    border: 1px solid var(--bs-gray-300, #e4e6ef);
    border-radius: 0.375rem;
    padding: 0.35rem 0.5rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.pivot-workspace .pvtCheckContainer {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.8125rem;
}

.pivot-workspace .pvtButton {
    background: var(--bs-primary, #009ef7);
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.pivot-workspace .pvtButton:hover {
    opacity: 0.9;
}

/* Loading state */
.pivot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    color: var(--bs-gray-600, #7e8299);
}

.pivot-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--bs-primary, #009ef7);
}

/* Empty / error */
.pivot-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--bs-gray-600, #7e8299);
}

.pivot-empty-state i {
    font-size: 2.5rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}
