/* --- START: MODERN DESIGN OVERHAUL & RESPONSIVE FIXES --- */
/* BODY GLOBALS */
body {
    margin: 0;
    padding: 0;
    background: #f2f2f2;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 54px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.bq-headless-page {
    background-color: #f0f2f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Container */
#bq-ownership-container {
    max-width: 1600px !important;
    width: 100%;
    /* FIX: Ensure the container respects the viewport width. */
    overflow-x: hidden;
    /* FIX: Prevent wide children from breaking the layout and enable internal scrolling. */
    box-sizing: border-box;
    /* FIX: Ensure padding is included in the total width calculation. */
    margin: 30px auto !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    padding: 0 15px;
}

.bq-page-header {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 25px;
    padding: 20px 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.bq-page-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

/* General Section Styling */
.bq-section {
    margin-bottom: 25px;
    padding: 25px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.bq-section h1 {
    font-size: 26px;
    font-weight: 600;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

.bq-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

/* Header with Dropdown */
.bq-section-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 13px;
}

.bq-section-header-with-controls h2 {
    border-bottom: none;
    margin-bottom: 0;
    flex-grow: 1;
}

.bq-chart-selector {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
    margin-bottom: 10px;
}

/* Grid Layouts */
.bq-two-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    align-items: start;
    margin-bottom: 20px;
}

.bq-four-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 25px;
}

/* --- START: Chart Box Styling --- */
.bq-chart-box {
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.bq-four-grid-layout .bq-chart-box {
    margin-bottom: 0;
}

/* --- END: Chart Box Styling --- */


/* Stats Block Styling */
.bq-stats-block {
    justify-content: center;
}

.bq-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px 20px;
    width: 100%;
}

.bq-stats-item strong {
    font-size: 1.5em;
    font-weight: 600;
    color: #111;
    display: block;
    line-height: 1.2;
    margin-bottom: 4px;
}

.bq-stats-item span {
    font-size: 0.9em;
    color: #6c757d;
    display: block;
}

/* Chart Container & Footer */
.chart-container {
    position: relative;
    flex-grow: 1;
    min-height: 300px;
    width: 100%;
}

.bq-chart-footer {
    display: none;
    justify-content: space-between;
    padding-top: 10px;
    margin: 10px 5px 0 5px;
    font-size: 13px;
    color: #858796;
    border-top: 1px solid #e3e6f0;
}

/* FIX: Hide CanvasJS branding */
.canvasjs-chart-credit {
    display: none !important;
}


/* Content Summary Styles */
.bq-content-summary p {
    margin-bottom: 1em;
    line-height: 1.6;
    font-size: 1em;
}

.bq-content-summary p:last-child {
    margin-bottom: 0;
}

/* Table Styles */
.data-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

#data-table-title {
    margin-bottom: 0 !important;
}

.bq-table-title-group {
    line-height: 1.3;
}

.bq-table-title-group h2 {
    font-size: 20px;
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 600;
}

.bq-table-subheader {
    font-size: 15px;
    color: #555;
    display: block;
}

/* --- START: Table Controls (Download Button & Rows Selector) --- */
.bq-table-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.bq-rows-per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bq-rows-per-page-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.bq-rows-per-page-selector select {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    height: 38px;
}

.bq-rows-per-page-selector select:disabled {
    cursor: not-allowed;
    background-color: #f6f7f7;
}

/* --- END: Table Controls --- */

.btn-download-table {
    background-color: #0073aa;
    color: white;
    border: 1px solid #0073aa;
    padding: 8px 8px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none !important;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    height: 38px;
}

.btn-download-table:hover:not(.locked) {
    background-color: #005a87;
    border-color: #005a87;
}

.btn-download-table.locked {
    background-color: #f6f7f7;
    border-color: #dcdcde;
    color: #50575e;
    cursor: pointer;
}

/* --- START: THE FIX - Style for the lock icon SVG in the download button --- */
.btn-download-table svg {
    width: 1em; /* Set width relative to the button's font size (approx 14px) */
    height: auto; /* Allow height to scale automatically, preserving aspect ratio */
    flex-shrink: 0; /* Prevent the icon from being squished horizontally */
}
/* --- END: THE FIX --- */

.bq-historic-data-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bq-data-table {
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9em;
    width: 100%;
}

.bq-data-table thead tr {
    background-color: #f8f9fa;
    color: #333;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.bq-data-table th,
.bq-data-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f1f1;
    white-space: nowrap;
}

.bq-data-table tbody tr:hover {
    background-color: #f1f8ff;
}

.bq-data-table th {
    white-space: nowrap;
    font-weight: 600;
}


/* --- START: FIX - Table Column Text Alignment --- */
.bq-data-table .bq-text-left,
.bq-sticky-header-table .bq-text-left {
    text-align: left !important;
}

.bq-data-table .bq-text-right,
.bq-sticky-header-table .bq-text-right {
    text-align: right !important;
}

/* --- END: FIX --- */


/* --- START: Table Sorting Styles --- */
.bq-data-table .sortable {
    cursor: pointer;
    position: relative;
    padding-right: 30px !important;
}

.bq-data-table .sortable::before,
.bq-data-table .sortable::after {
    content: "";
    position: absolute;
    right: 15px;
    border: 4px solid transparent;
    opacity: 0.3;
}

.bq-data-table .sortable::before {
    top: 50%;
    margin-top: -9px;
    border-bottom-color: #666;
}

.bq-data-table .sortable::after {
    top: 50%;
    margin-top: 1px;
    border-top-color: #666;
}

.bq-data-table .sorted-asc::before {
    opacity: 1;
}

.bq-data-table .sorted-desc::after {
    opacity: 1;
}

/* --- END: Table Sorting Styles --- */


/* --- FIX START: Sticky First Column for All Views --- */
.bq-data-table th:first-child,
.bq-data-table td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 2;
    /* border-right: 1px solid #ddd; */
}

.bq-data-table thead th:first-child {
    background-color: #f8f9fa;
    z-index: 3;
}

.bq-data-table tbody td:first-child {
    background-color: #ffffff;
    left: -1px;
}

.bq-data-table tbody tr:hover td:first-child {
    background-color: #f1f8ff;
}

/* On mobile, make the column a bit narrower and allow text to wrap */
@media (max-width: 768px) {

    .bq-data-table th:first-child,
    .bq-data-table td:first-child {
        width: 150px;
        min-width: 150px;
        white-space: normal;
    }


}


/* --- FIX END --- */


/* Pagination Styles */
.bq-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.pagination-info {
    color: #555;
    font-size: 14px;
    white-space: nowrap;
}

.bq-pagination {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
}

.bq-pagination .page-numbers {
    color: #495057;
    background-color: #fff;
    padding: 10px 18px;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid #dee2e6;
    border-right-width: 0;
    transition: background-color 0.2s;
    font-weight: 500;
}

.bq-pagination .page-numbers:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.bq-pagination .page-numbers:last-child {
    border-right-width: 1px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.bq-pagination a.page-numbers:hover {
    background-color: #f8f9fa;
}

.bq-pagination .page-numbers.current {
    background-color: #e9f5ff;
    color: #007bff;
    border-color: #a9d7ff;
    position: relative;
    z-index: 1;
}

.bq-pagination .dots {
    cursor: default;
    border: 1px solid #dee2e6;
    border-right-width: 0;
}

/* --- START: Additions for Statements Page --- */

/* Sub Navigation */
.bq-sub-navigation {
    width: 100%;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.bq-sub-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
}

.bq-sub-navigation li a {
    display: block;
    padding: 10px 16px;
    margin-bottom: -1px;
    /* To overlap the container border */
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.bq-sub-navigation li:not(.active) a:hover {
    color: #0073aa;
}

.bq-sub-navigation li.active a {
    color: #0073aa;
    border-bottom-color: #0073aa;
    font-weight: 600;
}

/* Statement Controls (DESKTOP LAYOUT) */
.bq-statement-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.bq-statement-controls form {
    /* Form now holds everything on the left */
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    /* Allow the form to take up space needed by left controls */
    flex-grow: 0;
    /* NEW: Pushes the form to the left */
    margin-right: auto;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Control Group for the elements on the RIGHT (Value Toggle, Reverse, Download) */
.control-group-right {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    flex-shrink: 0;
    justify-content: flex-end;
}

.control-group label {
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.control-group select {
    padding: 4px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    height: 35px;
}

.control-group select:disabled {
    background-color: #f0f2f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* --- START: Value Toggle Switch --- */
.bq-value-toggle {
    display: flex;
    background-color: #e9ecef;
    border-radius: 4px;
    padding: 2px;
    border: 1px solid #ddd;
}

/* Consistent button height */
.control-group-right .bq-icon-btn,
.control-group-right .btn-download-table,
.control-group-right .bq-value-toggle {
    height: 38px;
}

.bq-value-toggle .toggle-btn {
    height: 100%;
    display: flex;
    align-items: center;
    border: none;
    background-color: transparent;
    padding: 3px 15px;
    /* Reduced vertical padding for 34px height */
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #555;
    transition: all 0.2s ease-in-out;
    z-index: 2;
}

.bq-value-toggle .toggle-btn.active {
    background-color: #fff;
    color: #0073aa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- END: Value Toggle Switch --- */

/* --- FIX START: Icon Button Styling --- */
.bq-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #ddd;
    background-color: #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
}

.bq-icon-btn:hover {
    background-color: #d8dde1;
}

.bq-icon-btn svg {
    width: 22px;
    height: 22px;
    fill: #555;
}

/* --- FIX END --- */

/* ----------------------------------------------------------------- */
/* FIX: Reverse Symbol (MOVED OUTSIDE MEDIA QUERY FOR DESKTOP VISIBILITY) */
/* ----------------------------------------------------------------- */
#reverse-sequence-btn {
    width: 38px;
    height: 38px;
    font-size: 0;
    position: relative;
    display: inline-flex;

}

/* Use a horizontal interchange symbol */
#reverse-sequence-btn::before {
    content: '\21C4';
    /* Leftwards Arrow Over Rightwards Arrow (⇆ is \21C6) */
    font-family: Arial, sans-serif;
    /* Specify a common font for better support */
    font-size: 18px;
    color: #333;
    /* CHANGED: Darkened from #555 to a darker grey, #333 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


/* Statement Table Specific Styles */
.bq-statement-table th:first-child,
.bq-statement-table td:first-child {
    min-width: 300px !important;
    width: 300px !important;
    max-width: 300px !important; 
    white-space: normal; 
}

.bq-statement-table .item-name {
    display: inline-block; /* Changed from block to allow icon to align */
}

/* START: Restored Subtotal/Grandtotal Styling */
.bq-statement-table .item-subtotal {
    font-weight: bold;
}

.bq-statement-table .item-grandtotal {
    font-weight: bold;
}

.bq-statement-table .item-grandtotal td {
    border-top: 1.5px solid #333;
    border-bottom: 1.5px solid #333;
}
/* END: Restored Subtotal/Grandtotal Styling */

/* --- START: Indentation for Statement Line Items (ALL TYPES) --- */
.bq-statement-table [class*="level-"] .bq-text-left {
    padding-left: 10px; /* Base padding */
}
.bq-statement-table .level-1 .bq-text-left { padding-left: 30px; }
.bq-statement-table .level-2 .bq-text-left { padding-left: 50px; }
.bq-statement-table .level-3 .bq-text-left { padding-left: 70px; }
.bq-statement-table .level-4 .bq-text-left { padding-left: 90px; }
/* --- END: Indentation --- */

/* --- RESPONSIVE STYLES --- */
@media (max-width: 960px) {

    .bq-two-grid-layout,
    .bq-four-grid-layout {
        grid-template-columns: 1fr;
    }
}

.bq-statement-controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.bq-statement-controls .bq-control-container,
.bq-statement-s .control-group-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.desktop-label {
    display: inline;
}
.mobile-label {
    display: none;
}
/* ----------------------------
   Mobile Layout (below 768px)
---------------------------- */
@media (max-width: 768px) {
    .bq-sticky-header-wrapper {
        padding-top: 5px;
        padding-bottom: 5px;
        background: #f8f9fa !important;
    }

    /* .bq-sticky-header-wrapper table {
    border-collapse: collapse;
    table-layout: fixed;
    width: auto;
    margin: 0;
    font-size: 0.9em;
    background: #000 !important;
    } */

    .desktop-label {
        display: none !important;
    }
    .mobile-label {
        display: inline !important;
    }
    #bq-ownership-container {
        margin: 0;
        padding: 0;
    }

    .bq-page-header,
    .bq-section {
        border-radius: 0;
        margin-bottom: 10px;
        border-left: 0;
        border-right: 0;
    }

    .bq-page-header {
        padding: 15px;
    }

    .bq-page-header h1,
    .bq-section h1 {
        font-size: 20px;
    }

    .bq-section {
        padding: 9px;
        box-shadow: none;
        margin-bottom: 10px;
    }

    .bq-chart-box {
        padding: 15px;
    }

    .bq-stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .data-table-header {
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .bq-table-controls {
        flex-direction: column;
        align-items: flex-end;
        gap: 15px;
    }

    .bq-table-title-group h2 {
        font-size: 18px;
    }

    .bq-table-subheader {
        font-size: 14px;
    }

    .bq-table-footer {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .bq-data-table {
        font-size: 13px;
    }

    .bq-data-table th,
    .bq-data-table td {
        padding: 6px 10px;
    }

    /* Statement Page Responsive Adjustments */
    .bq-statement-controls {
        justify-content: space-between;
    }

    /* .control-group-right {
        justify-content: flex-end;
        margin-left: 0;
    } */

    /* THE FIX: Set mobile max-width for the first column */
    .bq-statement-table th:first-child,
    .bq-statement-table td:first-child {
        width: 148px !important;
        min-width: 148px !important;
        max-width: 148px !important;
    }

    .bq-sub-navigation ul {
        justify-content: space-around;
        margin-top: -8px !important;
        margin-bottom: 5px;
        padding-top: 0 !important;
    }

    .bq-sub-navigation li a {
        display: inline-block;
            padding-top: 6px !important;   /* reduce height from top */
    padding-bottom: 6px !important;
    padding: 8px 12px;
    border-radius: 6px; /* consistent shape even when not active */
    }

    .bq-sub-navigation li.active a {
    background-color: #e5f1ff !important; /* light blue */
    color: #0052cc !important;            /* dark blue text */
    border-radius: 6px;
    padding: 8px 14px;                    /* ensure padding stays consistent */
}

.bq-sub-navigation li.active a {
    border-bottom: none !important;
}
.bq-sub-navigation {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.bq-data-table .level-2 .bq-text-left,
.bq-data-table .level-3 .bq-text-left {
    font-weight: 400 !important;      /* Not bold */
    padding-top: 4px !important;      /* Extra vertical spacing */
    padding-bottom: 4px !important;
    color: #444 !important;           /* Slightly lighter */
}
.bq-data-table thead tr {
    height: 28px !important;          /* Reduce row height */
    line-height: 1.1 !important;      /* Compact text spacing */
    padding: 0 !important;            /* Remove top/bottom padding */
}

.bq-data-table thead th {
    padding: 2px 6px !important;      /* Tight padding inside header cells */
    font-size: 14px !important;       /* Slightly smaller header text */
    line-height: 1.2 !important;      /* Compact vertical spacing */
    vertical-align: middle !important;/* Center header text vertically */
    white-space: normal !important;
}

/* Optional: Reduce extra space between header and data rows */
.bq-data-table tbody tr:first-child td {
    padding-top: 3px !important;
}

    /* THE FIX: Set mobile indentation levels */
    .bq-statement-table .level-1 .bq-text-left { padding-left: 20px; }
    .bq-statement-table .level-2 .bq-text-left { padding-left: 40px; }
    .bq-statement-table .level-3 .bq-text-left { padding-left: 60px; }
    .bq-statement-table .level-4 .bq-text-left { padding-left: 80px; }

    .bq-data-table th, .bq-data-table td {
        padding: 6px 10px;
        line-height: 1.3;
    }

    .bq-sticky-header-wrapper th {
    padding: 2px 4px !important;   /* reduced right and left padding */
    line-height: 1.1 !important;
    font-size: 13px !important;
    white-space: normal !important;
}

    .bq-date-wrapper {
        display: inline-flex;
        flex-direction: column;
        line-height: 1.1;
        align-items: flex-end; /* matches table alignment */
        padding-right:5px;
    }

    .item-link-icon {
        display: none !important;
    }
}

/* New styles for Period Selector & Loader */
.bq-period-selector {
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 10px;
}

.bq-period-selector a {
    padding: 5px 12px;
    text-decoration: none;
    color: #333;
    background-color: #f7f7f7;
    border-right: 1px solid #ccc;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

.bq-period-selector a:last-child {
    border-right: none;
}

.bq-period-selector a:hover {
    background-color: #e9e9e9;
}

.bq-period-selector a.active {
    background-color: #0073aa;
    color: white;
    font-weight: bold;
}

#bq-data-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bq-loader-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0073aa;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- END: MODERN DESIGN OVERHAUL & RESPONSIVE FIXES --- */


/*
 * AJAX Loading Indicator Styles
 * -------------------------------------------------- */

/* 1. Prepare the container for positioning the loader */
#institutional-table-wrapper,
#insider-transactions-table-wrapper {
    position: relative;
    min-height: 250px;
    /* Prevents the container from collapsing during load */
    transition: min-height 0.3s ease-in-out;
}

/* 2. Create the semi-transparent overlay */
#institutional-table-wrapper.bq-loading::after,
#insider-transactions-table-wrapper.bq-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.75);
    z-index: 10;
    border-radius: 4px;
    /* Optional: matches table border-radius */
}

/* 3. Create and center the spinner icon */
#institutional-table-wrapper.bq-loading::before,
#insider-transactions-table-wrapper.bq-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;

    /* Centering trick */
    transform: translate(-50%, -50%);

    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid #f3f3f3;
    /* Light grey track */
    border-top: 4px solid #3498db;
    /* Blue moving part */

    animation: bq-spin 1s linear infinite;
    z-index: 11;
    /* Ensure spinner is on top of the overlay */
}

/* 4. Define the spinning animation */
@keyframes bq-spin {
    0% {
        /* The centering transform must be included in the animation */
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* =====================================================
   INTEGRATED TABLE + STICKY HEADER STYLES (MERGED)
   ===================================================== */

/* Table Wrappers (Unchanged) */
/* .bq-historic-data-wrapper is defined above */


/* Base table styling */
/* The .bq-data-table class defined at the top of the file handles this */


/* Sticky First Column (Original Table Body/Header) */
.bq-data-table th:nth-child(-n+1),
.bq-data-table td:nth-child(-n+1) {
    position: sticky;
    z-index: 4;
    background-color: #fff;
    /* Default background for sticky body cells */
}

.bq-data-table thead th:nth-child(-n+1) {
    background-color: #f8f9fa;
    /* Header background for sticky header cells */
    z-index: 6;
    left: -1px;
    /* Higher Z-index for sticky header cells */
}

.bq-data-table tbody tr:hover td:nth-child(-n+1) {
    background-color: #f1f8ff;
}

/* 1st column position (Original Table) */
.bq-data-table th:first-child,
.bq-data-table td:first-child {
    left: 0;
    z-index: 5;
    /* Use the same width definitions as in your original media query fix */
    width: 180px;
    min-width: 180px;
    
}


/* -------------------------------------------
   STICKY HEADER CLONE STYLES (MODIFIED FOR STRICT FREEZE)
   ------------------------------------------- */

.bq-sticky-header-wrapper {
    position: fixed;
    top: 54px;
    /* Default desktop position */
    /* IMPORTANT: The width must be set by JavaScript to match the table's scrollable wrapper */
    max-width: 1600px;
    /* Match max-width of #bq-ownership-container */
    width: 100%;
    left: 1px;
    z-index: 999; /* Lowered to be below popups */
    display: none;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow-x: hidden;
    /* Scroll should be handled by the original table's wrapper */
    overflow-y: hidden;
    box-sizing: border-box;
}

/* --- START: POPUP FIX --- */
/* When a popup is active on the body, hide the sticky header completely to allow the overlay to cover it. */
/* NOTE: 'bq-popup-is-active' is a placeholder. Replace with the actual class your popup script adds to the <body> tag. */
body.bq-popup-is-active .bq-sticky-header-wrapper {
    display: none !important;
}
/* --- END: POPUP FIX --- */

.bq-sticky-header-wrapper table {
    border-collapse: collapse;
    /* Must be fixed layout for JS to assign column widths correctly */
    table-layout: fixed;
    /* IMPORTANT: width will be set by JavaScript */
    width: auto;
    margin: 0;
    /* Inherit font size for consistency */
    font-size: 0.9em;
}

.bq-sticky-header-wrapper th {
    /* Inherit all styles from the original table's header */
    padding: 6px 10px;
    text-align: left;
    /* background-color: #f8f9fa; */
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    /* Remove any border-right from the base th in the sticky header clone */
    border-right: none;
}


/* 1st column (STRICTLY FREEZE - NEW TECHNIQUE) */
.bq-sticky-header-wrapper th:first-child {
    left: 0;
    /* width: 286.742px; (Commented out as JS should set this) */
    min-width: 180px; /* This is a base, JS will override */
    max-width: 250px; 
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);

    /* CRITICAL FIX: The entire cloned table is being transformed by JS. 
       To freeze this cell, we must apply the inverse transform to cancel out the scroll. */
    position: sticky;
    z-index: 11;
    /* Ensure it's above other sticky columns */
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
}

.bq-period-select-mobile {
    display: none;
}

/* ... (Your existing code up to @media (max-width: 1024px)) ... */

/* -------------------------------------------
   RESPONSIVE STYLES (REFINED - ADDED STICKY TOP ADJUSTMENT)
   ------------------------------------------- */
/* General mobile spacing for BQ statement controls */
@media (max-width: 512px) {
    .bq-period-selector {
        display: none;
    }

    /* Set the container to position: relative to allow absolute positioning of the prefix */
    .bq-period-container {
        position: relative; 
        /* Set flex-basis to slightly less than 50% to account for gap */
        /* flex: 0 0 calc(50% - 5px);  */
        position: relative;
        max-width: 150px; /* won’t go beyond this */
        margin-left: 0; 
        right: 0px;
        margin-bottom: 10px;
    }

    .bq-period-select-mobile, .bq-frequency-container select {
        color: #333;
    }

    /* Set the container to position: relative to allow absolute positioning of the prefix */
    .bq-frequency-container {
        position: relative; 
        /* Set flex-basis to slightly less than 50% to account for gap */
        flex: 0 0 calc(50% - 5px);
        margin-bottom: 10px;
    }

    .bq-period-select-mobile {
        display: inline-block;
        width: 100px;
        padding: 6px 10px;
        font-size: 14px;
        border-radius: 6px;
        border: 1px solid #ccc;
        background-color: #fff;
        /* MODIFIED: Increased padding-left to 80px for maximum separation for "Period:" */
        padding-left: 80px; 
        text-align: right;
    }

    .bq-statement-controls {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 5px;
    }

    /* 👇 MODIFICATION FOR 50/50 WIDTH (ORIGINAL) 👇 */
    /* Period container: Take 50% width */
    /* Handled above: flex: 0 0 calc(50% - 5px); */

    /* Frequency container: Take 50% width */
    /* Handled above: flex: 0 0 calc(50% - 5px); */
    /* 👆 MODIFICATION FOR 50/50 WIDTH (ORIGINAL) 👆 */

    .bq-statement-controls .bq-control-container,
    .bq-statement-controls .control-group-right {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Frequency select */
    .bq-frequency-container select {
        width: 100%;
        /* Padding remains 75px for "Frequency:" */
        padding-left: 75px; 
    }

    .control-group-right {
        flex: 0 0 100%;
        display: flex;
        justify-content: space-between;
        gap: 8px;
        order: 3;
        height: 24px;
        padding-left: -9px !important;
        padding-right: -9px !important;
    }

    .bq-format-container,
    .bq-reverse-container,
    .bq-download-container {
        flex: 1;
        position: relative;
    }

    .bq-download-container #js-download-link,
    .bq-reverse-container #reverse-sequence-btn {
        width: 100%;
        text-align: center;
        border-radius: 6px;
    }

    .bq-format-container .bq-value-toggle {
        width: 100%;
        flex-wrap: nowrap;
        border-radius: 6px;
        display: flex;
        margin: 0;
    }

    .bq-format-container .bq-value-toggle button {
        flex-grow: 1;
        border-radius: 0;
    }

    .bq-format-container .bq-value-toggle button:first-child {
        border-top-left-radius: 6px;
        border-bottom-left-radius: 6px;
    }

    .bq-format-container .bq-value-toggle button:last-child {
        border-top-right-radius: 6px;
        border-bottom-right-radius: 6px;
    }

    /* Hide labels on mobile */
    .bq-statement-controls label {
        display: none !important;
    }
    
    /* 👇 ADDED PREFIXES INSIDE DROPDOWNS VIA PSEUDO-ELEMENTS AND POSITIONING 👇 */
    /* Period Prefix */
    .bq-period-container::before {
        content: "Period:";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 10px; /* Position to start of box */
        z-index: 1; 
        display: flex;
        align-items: center; 
        color: #6c757d;
        font-weight: 500;
        font-size: 14px;
        pointer-events: none; 
    }

    /* Frequency Prefix */
    .bq-frequency-container::before {
        content: "Frequency:";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 10px; /* Position to start of box */
        z-index: 1;
        display: flex;
        align-items: center;
        color: #6c757d;
        font-weight: 500;
        font-size: 14px;
        pointer-events: none;
    }
    /* 👆 ADDED PREFIXES INSIDE DROPDOWNS VIA PSEUDO-ELEMENTS AND POSITIONING 👆 */

    /* Ensure dropdown text is visible */
    .bq-period-select-mobile,
    .bq-frequency-container select {
        color: #333;
    }

    .bq-sticky-header-wrapper {
    position: fixed;
    top: 56px;
    /* Default desktop position */
    /* IMPORTANT: The width must be set by JavaScript to match the table's scrollable wrapper */
    max-width: 1600px;
    /* Match max-width of #bq-ownership-container */
    width: 100%;
    left: 10px;
    z-index: 999; /* Lowered to be below popups */
    display: none;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow-x: hidden;
    /* Scroll should be handled by the original table's wrapper */
    overflow-y: hidden;
    box-sizing: border-box;
}
}

/* --- START: URL Linking Styles with Icon for Statement Line Items --- */
/* This replaces the old, underlined link style */
.bq-data-table .item-name-link {
    display: inline-flex; /* Use flexbox to align name and icon */
    align-items: center;
    gap: 8px; /* Space between name and icon */
    text-decoration: none; /* Remove underline */
    color: inherit;
    cursor: pointer;
}

.bq-data-table .item-name-link:hover .item-name {
    color: #0073aa; /* Change text color on hover */
}

.bq-data-table .item-name-link:hover .item-link-icon {
    fill: #555; /* Darken icon slightly on hover */
}

.item-link-icon {
    width: 14px;
    height: 14px;
    fill: #b0b0b0; /* Light grey for the icon */
    transition: fill 0.2s ease;
    flex-shrink: 0; /* Prevent icon from shrinking */
}
/* --- END: URL Linking Styles --- */

.bq-sticky-header-wrapper{
    border-left: 1px solid #ded9d9;
    border-right: 1px solid #ded9d9;
}
.bq-historic-data-wrapper{
    border-left: 1px solid #eeeeee;
    border-right: 1px solid #eeeeee;
}


/* --- START: PEERS PAGE STICKY COLUMN CORRECTIONS --- */

/* OVERRIDE: Remove generic first-column sticky behavior for the Peers table */
#peers-table th:first-child,
#peers-table td:first-child {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    border-right: none !important;
    box-shadow: none !important;
    background-color: transparent; /* Reset background for non-sticky cell */
}

/* Make the 2nd column (Ticker) sticky instead in the MAIN table */
#peers-table th:nth-child(2),
#peers-table td:nth-child(2) {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 2; 
    background-color: #ffffff;
    box-shadow: 2px 0 5px -2px rgba(0,0,0,0.1);
}

/* Ensure sticky header for 2nd column has correct background and z-index */
#peers-table thead th:nth-child(2) {
    background-color: #f8f9fa; 
    z-index: 3; 
}

/* Correct background colors for 2nd column on hover and highlight */
#peers-table tr.highlight-row td:nth-child(2) {
    background-color: #e9f5ff;
}
#peers-table tbody tr:hover td:nth-child(2) {
    background-color: #f1f8ff;
}

/* --- THE FIX for CLONED HEADER --- */
/* Ensure the cloned table wrapper is correctly positioned for the absolute child */
.bq-sticky-header-wrapper table {
    position: relative;
}

/* Make the 2nd column in the *cloned sticky header* position itself absolutely,
   allowing JS to control its 'left' property for perfect alignment. */
.bq-sticky-header-wrapper th:nth-child(2) {
    position: sticky; /* THIS IS THE KEY CHANGE from 'sticky' to 'absolute' */
    top: 0;
    z-index: -100;
    background-color: #f8f9fa !important;
    /* border-right: 1px solid #dee2e6; */
    box-shadow: 2px 0 5px -2px rgba(0,0,0,0.1);
}

/* Also ensure the first column in the cloned header is NOT sticky */
.bq-sticky-header-wrapper th:first-child {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    border-right: none !important;
    box-shadow: none !important;
}

/* --- END: PEERS PAGE STICKY COLUMN CORRECTIONS --- */

.bq-content-summary ul li {
    margin-bottom: 2px;
}


.bq-secondary-nav-container {
    margin-bottom: 25px;
}

/* Date Formatting Fix */
.bq-date-wrapper {
    display: block;
    line-height: 1.2;
}
.bq-month {
    font-size: 12px;
    font-weight: normal;
}
.bq-year {
    font-size: 14px;
    font-weight: bold;
    display: block;
}


