/* Pivot Table Creator Tool Styles */

.pivot-table-container {
    max-height: 600px;
    overflow: auto;
}

.pivot-table {
    font-size: 0.875rem;
}

.pivot-table th,
.pivot-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

.pivot-table th {
    position: sticky;
    top: 0;
    background-color: var(--bs-table-bg);
    z-index: 10;
    font-weight: 600;
}

[data-bs-theme="dark"] .pivot-table th {
    background-color: var(--bs-dark);
}

.pivot-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
}

/* First column (row labels) sticky */
.pivot-table tbody th:first-child,
.pivot-table tbody td:first-child {
    position: sticky;
    left: 0;
    background-color: var(--bs-table-bg);
    z-index: 5;
}

[data-bs-theme="dark"] .pivot-table tbody th:first-child,
[data-bs-theme="dark"] .pivot-table tbody td:first-child {
    background-color: var(--bs-dark);
}

/* Grand total row */
.pivot-table .table-active {
    font-weight: 600;
}

/* Pivot configuration section */
#pivotConfig {
    background-color: var(--bs-light);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] #pivotConfig {
    background-color: var(--bs-gray-800);
}

#pivotConfig h5 {
    margin-bottom: 1rem;
    color: var(--bs-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pivot-table-container {
        max-height: 400px;
    }

    .pivot-table th,
    .pivot-table td {
        font-size: 0.8rem;
        padding: 0.375rem;
        min-width: 80px;
    }

    .card-footer {
        flex-direction: column;
    }

    .card-footer .btn {
        width: 100%;
    }

    #pivotConfig {
        padding: 1rem;
    }
}
