/* ================================================================
   ARR PIVOT TABLE - COMPLETE OVERRIDE STYLESHEET
   This file MUST be loaded LAST to override all conflicting styles
   ================================================================ */

/* Force the pivot container to have a light background */
body .pivot-table-container,
.arr-section .pivot-table-container,
#arr-pivot-table .pivot-table-container,
.section-content .pivot-table-container {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
}

/* Table wrapper needs white background */
body .pivot-table-container .table-wrapper,
.arr-section .pivot-table-container .table-wrapper,
#arr-pivot-table .pivot-table-container .table-wrapper {
    background: #ffffff !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: 70vh !important;
}

/* Force scrollbar styling for light theme */
body .pivot-table-container .table-wrapper::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

body .pivot-table-container .table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 5px !important;
}

body .pivot-table-container .table-wrapper::-webkit-scrollbar-thumb {
    background: #94a3b8 !important;
    border-radius: 5px !important;
}

body .pivot-table-container .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #64748b !important;
}

/* The table itself */
body .pivot-table-container .pivot-table,
body .pivot-table-container table.pivot-table,
body table.pivot-table,
.arr-section .pivot-table,
#arr-pivot-table .pivot-table {
    width: 100% !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    background: #ffffff !important;
    table-layout: auto !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

/* ==============================================
   TABLE HEADER - Dark Professional Style
   ============================================== */
body .pivot-table-container .pivot-table th,
body .pivot-table-container .pivot-table thead th,
body .pivot-table th,
body .pivot-table thead th,
body table.pivot-table th,
body table.pivot-table thead th,
.arr-section .pivot-table th,
.arr-section .pivot-table thead th,
#arr-pivot-table .pivot-table th,
#arr-pivot-table .pivot-table thead th,
body .pivot-table-container .pivot-table th.month-header,
body .pivot-table th.month-header,
body .pivot-table th.arr-column,
body .pivot-table th.id-column,
body .pivot-table th.name-column,
body .pivot-table th.product-column {
    background: #1e293b !important;
    background-image: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    padding: 14px 12px !important;
    text-align: center !important;
    border: none !important;
    border-bottom: 3px solid #3b82f6 !important;
    border-right: 1px solid #334155 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    white-space: nowrap !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
}

/* First column - Reporting ID */
body .pivot-table-container .pivot-table th:first-child,
body .pivot-table th:first-child,
body table.pivot-table th:first-child,
.arr-section .pivot-table th:first-child,
#arr-pivot-table .pivot-table th:first-child {
    background: #0f172a !important;
    text-align: left !important;
    padding-left: 16px !important;
    min-width: 120px !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 110 !important;
}

/* Second column - Reporting Name */
body .pivot-table-container .pivot-table th:nth-child(2),
body .pivot-table th:nth-child(2),
body table.pivot-table th:nth-child(2),
.arr-section .pivot-table th:nth-child(2),
#arr-pivot-table .pivot-table th:nth-child(2) {
    background: #0f172a !important;
    text-align: left !important;
    min-width: 180px !important;
}

/* ==============================================
   TABLE BODY CELLS - Light Theme with Dark Text
   ============================================== */
body .pivot-table-container .pivot-table td,
body .pivot-table-container .pivot-table tbody td,
body .pivot-table td,
body .pivot-table tbody td,
body table.pivot-table td,
body table.pivot-table tbody td,
.arr-section .pivot-table td,
.arr-section .pivot-table tbody td,
#arr-pivot-table .pivot-table td,
#arr-pivot-table .pivot-table tbody td {
    color: #1e293b !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    padding: 12px !important;
    text-align: right !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: 1px solid #f1f5f9 !important;
    white-space: nowrap !important;
    background: #ffffff !important;
    background-image: none !important;
    transition: background-color 0.15s ease !important;
    font-variant-numeric: tabular-nums !important;
}

/* First column cells - Reporting ID */
body .pivot-table-container .pivot-table td:first-child,
body .pivot-table td:first-child,
body table.pivot-table td:first-child,
.arr-section .pivot-table td:first-child,
#arr-pivot-table .pivot-table td:first-child,
body .pivot-table-container .pivot-table tbody td:first-child,
body .pivot-table tbody td:first-child {
    text-align: left !important;
    padding-left: 16px !important;
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    background: #f8fafc !important;
    background-image: none !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 5 !important;
}

/* Second column cells - Reporting Name */
body .pivot-table-container .pivot-table td:nth-child(2),
body .pivot-table td:nth-child(2),
body table.pivot-table td:nth-child(2),
.arr-section .pivot-table td:nth-child(2),
#arr-pivot-table .pivot-table td:nth-child(2),
body .pivot-table-container .pivot-table tbody td:nth-child(2),
body .pivot-table tbody td:nth-child(2) {
    text-align: left !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    max-width: 220px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    background: #f8fafc !important;
    background-image: none !important;
}

/* ==============================================
   ZEBRA STRIPING - Alternating Row Colors
   ============================================== */
body .pivot-table-container .pivot-table tr:nth-child(odd) td,
body .pivot-table tr:nth-child(odd) td,
body table.pivot-table tr:nth-child(odd) td,
.arr-section .pivot-table tr:nth-child(odd) td,
#arr-pivot-table .pivot-table tr:nth-child(odd) td,
body .pivot-table-container .pivot-table tbody tr:nth-child(odd) td,
body .pivot-table tbody tr:nth-child(odd) td {
    background: #ffffff !important;
    background-image: none !important;
}

body .pivot-table-container .pivot-table tr:nth-child(even) td,
body .pivot-table tr:nth-child(even) td,
body table.pivot-table tr:nth-child(even) td,
.arr-section .pivot-table tr:nth-child(even) td,
#arr-pivot-table .pivot-table tr:nth-child(even) td,
body .pivot-table-container .pivot-table tbody tr:nth-child(even) td,
body .pivot-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
    background-image: none !important;
}

/* First two columns maintain their styling on even rows */
body .pivot-table-container .pivot-table tr:nth-child(even) td:first-child,
body .pivot-table tr:nth-child(even) td:first-child,
body .pivot-table-container .pivot-table tr:nth-child(even) td:nth-child(2),
body .pivot-table tr:nth-child(even) td:nth-child(2) {
    background: #f1f5f9 !important;
    background-image: none !important;
}

/* ==============================================
   HOVER EFFECTS - Light Blue Highlight
   ============================================== */
body .pivot-table-container .pivot-table tr:hover td,
body .pivot-table tr:hover td,
body table.pivot-table tr:hover td,
.arr-section .pivot-table tr:hover td,
#arr-pivot-table .pivot-table tr:hover td,
body .pivot-table-container .pivot-table tbody tr:hover td,
body .pivot-table tbody tr:hover td,
body .pivot-table-container .pivot-table tr:nth-child(odd):hover td,
body .pivot-table-container .pivot-table tr:nth-child(even):hover td,
body .pivot-table tr:nth-child(odd):hover td,
body .pivot-table tr:nth-child(even):hover td {
    background: #e0f2fe !important;
    background-image: none !important;
}

/* Cell hover */
body .pivot-table-container .pivot-table td:hover,
body .pivot-table td:hover,
body table.pivot-table td:hover {
    background: #bfdbfe !important;
    background-image: none !important;
}

/* ==============================================
   NUMERIC VALUE CELLS
   ============================================== */
body .pivot-table-container .pivot-table td.arr-value,
body .pivot-table td.arr-value,
body .pivot-table-container .pivot-table td.value-cell,
body .pivot-table td.value-cell,
body .pivot-table-container .pivot-table td[data-value],
body .pivot-table td[data-value] {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace !important;
    font-variant-numeric: tabular-nums !important;
    text-align: right !important;
    color: #0f172a !important;
    font-weight: 500 !important;
}

/* Positive values - green tint */
body .pivot-table td.positive,
body .pivot-table-container .pivot-table td.positive {
    color: #166534 !important;
}

/* Negative values - red tint */
body .pivot-table td.negative,
body .pivot-table-container .pivot-table td.negative {
    color: #dc2626 !important;
}

/* Zero values - muted */
body .pivot-table td.zero,
body .pivot-table-container .pivot-table td.zero {
    color: #94a3b8 !important;
}

/* ==============================================
   TABLE HEADER ROW CONTAINER
   ============================================== */
body .pivot-table-container .table-header,
.arr-section .pivot-table-container .table-header,
#arr-pivot-table .pivot-table-container .table-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    padding: 1rem 1.25rem !important;
    border-bottom: none !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

body .pivot-table-container .table-header h3,
.arr-section .pivot-table-container .table-header h3,
#arr-pivot-table .pivot-table-container .table-header h3 {
    color: #ffffff !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

/* ==============================================
   SPECIAL COLUMN CLASSES
   ============================================== */
body .pivot-table .id-value,
body .pivot-table-container .pivot-table .id-value {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace !important;
    color: #0f172a !important;
    font-weight: 600 !important;
}

body .pivot-table .name-value,
body .pivot-table-container .pivot-table .name-value {
    color: #1e293b !important;
    font-weight: 500 !important;
}

body .pivot-table .product-value,
body .pivot-table-container .pivot-table .product-value {
    color: #475569 !important;
    font-weight: 400 !important;
    font-style: italic !important;
}

/* ==============================================
   REMOVE ANY REMAINING DARK THEME ARTIFACTS
   ============================================== */
body .pivot-table-container *,
body .pivot-table *,
.arr-section .pivot-table-container *,
.arr-section .pivot-table *,
#arr-pivot-table .pivot-table-container *,
#arr-pivot-table .pivot-table * {
    --text-primary: #1e293b !important;
    --text-secondary: #475569 !important;
    --bg-primary: #ffffff !important;
    --bg-secondary: #f8fafc !important;
}

/* Remove gradients from any linear-gradient styles */
body .pivot-table-container .pivot-table td[style*="linear-gradient"],
body .pivot-table td[style*="linear-gradient"],
body .pivot-table-container .pivot-table tr td[style*="linear-gradient"],
body .pivot-table tr td[style*="linear-gradient"] {
    background: #ffffff !important;
    background-image: none !important;
}

/* Force override any inline styles */
body .pivot-table-container .pivot-table td[style],
body .pivot-table td[style] {
    background-color: inherit !important;
}

/* ==============================================
   PAGINATION CONTROLS
   ============================================== */
body .pivot-table-container .pagination-controls,
.arr-section .pagination-controls,
#arr-pivot-table .pagination-controls {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 12px 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

body .pivot-table-container .pagination-info,
.arr-section .pagination-info {
    color: #64748b !important;
    font-size: 0.875rem !important;
}

body .pivot-table-container .pagination-btn,
.arr-section .pagination-btn {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
}

body .pivot-table-container .pagination-btn:hover,
.arr-section .pagination-btn:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

body .pivot-table-container .pagination-btn.active,
.arr-section .pagination-btn.active {
    background: #1e293b !important;
    color: #ffffff !important;
    border-color: #1e293b !important;
}

/* Additional CSS overrides for pivot table - append to arr-table-fix.css */

/* Override specific conflicting classes from main.css */
body .pivot-table .pivot-cell.numeric,
body .pivot-table-container .pivot-table .pivot-cell.numeric,
.arr-section .pivot-table .pivot-cell.numeric,
#arr-pivot-table .pivot-table .pivot-cell.numeric,
table.pivot-table .pivot-cell.numeric,
.pivot-table td.pivot-cell.numeric {
    color: #0f172a !important;
    background: #ffffff !important;
    background-image: none !important;
}

body .pivot-table .arr-value,
body .pivot-table-container .pivot-table .arr-value,
.arr-section .pivot-table .arr-value,
#arr-pivot-table .pivot-table .arr-value,
table.pivot-table .arr-value,
.pivot-table td.arr-value {
    color: #0f172a !important;
    background: transparent !important;
    background-image: none !important;
}

body .pivot-table .id-value,
body .pivot-table-container .pivot-table .id-value,
.arr-section .pivot-table .id-value,
#arr-pivot-table .pivot-table .id-value,
table.pivot-table .id-value,
.pivot-table td.id-value {
    color: #0f172a !important;
    font-weight: 600 !important;
}

body .pivot-table .name-value,
body .pivot-table-container .pivot-table .name-value,
.arr-section .pivot-table .name-value,
#arr-pivot-table .pivot-table .name-value,
table.pivot-table .name-value,
.pivot-table td.name-value {
    color: #1e293b !important;
    font-weight: 500 !important;
}

body .pivot-table .product-value,
body .pivot-table-container .pivot-table .product-value,
.arr-section .pivot-table .product-value,
#arr-pivot-table .pivot-table .product-value,
table.pivot-table .product-value,
.pivot-table td.product-value {
    color: #475569 !important;
}

body .pivot-table .pivot-cell,
body .pivot-table-container .pivot-table .pivot-cell,
.arr-section .pivot-table .pivot-cell,
#arr-pivot-table .pivot-table .pivot-cell,
table.pivot-table .pivot-cell,
.pivot-table td.pivot-cell {
    color: #1e293b !important;
    background: #ffffff !important;
    background-image: none !important;
}

/* Zebra striping that works with these classes */
body .pivot-table tr:nth-child(even) .pivot-cell,
body .pivot-table tr:nth-child(even) .pivot-cell.numeric,
body .pivot-table tr:nth-child(even) .arr-value,
body .pivot-table tr:nth-child(even) .id-value,
body .pivot-table tr:nth-child(even) .name-value {
    background: #f8fafc !important;
    background-image: none !important;
    color: #1e293b !important;
}

body .pivot-table tr:nth-child(odd) .pivot-cell,
body .pivot-table tr:nth-child(odd) .pivot-cell.numeric,
body .pivot-table tr:nth-child(odd) .arr-value,
body .pivot-table tr:nth-child(odd) .id-value,
body .pivot-table tr:nth-child(odd) .name-value {
    background: #ffffff !important;
    background-image: none !important;
    color: #1e293b !important;
}

/* Hover states */
body .pivot-table tr:hover .pivot-cell,
body .pivot-table tr:hover .pivot-cell.numeric,
body .pivot-table tr:hover .arr-value,
body .pivot-table tr:hover td {
    background: #e0f2fe !important;
    background-image: none !important;
    color: #0f172a !important;
}

/* Editable cells */
body .pivot-table .arr-value.editable-cell,
body .pivot-table .pivot-cell.numeric.arr-value.editable-cell {
    color: #0f172a !important;
    cursor: pointer !important;
}

/* Adjusted cells */
body .pivot-table .arr-value.adjusted,
body .pivot-table .pivot-cell.numeric.adjusted {
    color: #166534 !important;
    font-weight: 600 !important;
}

/* Make sure text is visible in all states */
body .pivot-table td,
body .pivot-table td.pivot-cell,
body .pivot-table td.pivot-cell.numeric,
body .pivot-table td.arr-value {
    color: #1e293b !important;
}

body .pivot-table td:first-child,
body .pivot-table td.id-value {
    color: #0f172a !important;
}

