/* FIX: Hide the global header's search icon on mobile for this page only */
#mobile-search-icon {
    display: none !important;
}

/* Hide search bar from global header on this specific page */
.main-menu .header-search-wrapper {
    display: none !important;
}

* {
    box-sizing: border-box;
}

body {
    /* Define a fallback value for the sticky header offset */
    --sticky-header-offset: 54px;
}

body.industry-financials-page {
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    background: #f2f2f2 !important;
    color: #333 !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
    font-weight: 300 !important;
}

body.industry-financials-page .site-footer,
body.industry-financials-page .wp-site-blocks,
body.industry-financials-page .site-main,
body.industry-financials-page .site-info,
body.industry-financials-page .entry-header,
body.industry-financials-page .entry-content,
body.industry-financials-page .entry-footer {
    display: none !important;
}

/* Definitive Rule to Hide Header Search */
body.industry-financials-page header [class*="search"],
body.industry-financials-page #masthead [class*="search"] {
    display: none !important;
}

.plugin-wrapper {
    margin: 0 !important; padding: 0 !important; max-width: none !important;
    width: 100% !important; min-height: 100vh !important; background: #f2f2f2 !important;
}

.plugin-container {
    max-width: 1600px !important; width: 100% !important; margin: 80px auto !important;
    display: flex !important; flex-direction: column !important; gap: 20px;
    min-height: calc(100vh - 140px) !important; padding: 70px 20px !important;
}

.controls-container {
    display: flex !important;
    gap: 30px !important;
    padding: 20px !important;
    background: white !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e9ecef !important;
    align-items: center !important; /* Vertically center controls */
}

.left-controls, .right-controls {
    display: flex !important;
    gap: 30px !important;
    align-items: center !important; /* Vertically center controls */
}

.action-buttons-group { display: flex; align-items: center; gap: 15px; }

.right-controls { border-left: 1px solid #e9ecef; padding-left: 30px; margin-left: 15px; }
.right-controls .action-buttons-group { border-left: 1px solid #e9ecef; padding-left: 15px; margin-left: 0; }

.dropdown-container {
    display: flex !important; flex-direction: column !important; min-width: 250px !important;
}
.dropdown-container label {
    font-size: 13px !important; color: #555 !important; margin-bottom: 4px !important;
    display: block !important; font-weight: 500 !important;
}

/* Hide the underlying <select> element and its generated Tom Select wrapper */
#metrics-dropdown,
#metrics-dropdown + .ts-wrapper {
    display: none !important;
}

/* Custom Metrics Trigger Control */
.metrics-trigger-control {
    background-color: #ffffff !important; border: 1px solid #ced4da !important;
    border-radius: 4px !important; min-height: 38px !important;
    padding: 2px 8px !important; cursor: pointer !important; width: 100% !important;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out !important;
    display: flex; align-items: center;
}
.metrics-trigger-control:focus, .metrics-trigger-control:hover {
    border-color: #86b7fe !important; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important; outline: none;
}
.metrics-pills-container { padding: 3px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.metrics-pills-container .item {
    background: #e2efff; color: #004085; border-radius: 3px;
    padding: 3px 6px; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
}
.metrics-pills-container .remove-pill { font-weight: bold; font-size: 16px; line-height: 1; opacity: 0.7; }
.metrics-pills-container .remove-pill:hover { opacity: 1; }
.metrics-pills-container .placeholder { color: #6c757d; padding: 5px 2px; }

/* Tom Select Styling */
.ts-control {
    border: 1px solid #ced4da !important; border-radius: 4px !important; height: 38px !important;
    padding: 6px 12px !important;
}
.ts-wrapper.focus .ts-control {
    border-color: #86b7fe !important; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}
.ts-dropdown {
    z-index: 20 !important;
}

.plugin-wrapper .control-btn {
    background: white !important; color: #4a4a4a !important; border: 1px solid #dbdbdb !important;
    border-radius: 4px !important; cursor: pointer !important; height: 38px !important;
    font-size: 14px !important; padding: 0 16px !important; transition: all ease-in-out 0.2s !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important; display: inline-flex !important;
    align-items: center !important; justify-content: center !important; gap: 8px !important;
    font-weight: 500 !important; white-space: nowrap !important;
}
.plugin-wrapper .control-btn:hover { background: #f5f5f5 !important; border-color: #b5b5b5 !important; }
.plugin-wrapper .control-btn svg { width: 16px; height: 16px; }

.toggle-container { display: flex !important; align-items: center !important; }
.toggle-label { font-size: 14px !important; font-weight: 500 !important; color: #333 !important; }
.switch { position: relative !important; display: inline-block !important; width: 60px !important; height: 24px !important; }
.switch input { opacity: 0 !important; width: 0 !important; height: 0 !important; }
.slider { position: absolute !important; cursor: pointer !important; inset: 0; background-color: #ccc !important; transition: .4s !important; }
.slider:before { position: absolute !important; content: "" !important; height: 20px !important; width: 20px !important; left: 2px !important; bottom: 2px !important; background-color: white !important; transition: .4s !important; }
input:checked + .slider { background-color: #217ab4 !important; margin-left:10px; width:50px;}
input:checked + .slider:before { transform: translateX(26px) !important; }
.slider.round { border-radius: 24px !important; margin-left:10px; width:50px;}
.slider.round:before { border-radius: 50% !important; }

.bq-toast { position: fixed !important; top: 50% !important; left: 50% !important; padding: 12px 24px !important; background-color: #FFE082 !important; color: #000000 !important; border-radius: 4px !important; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important; opacity: 0 !important; transform: translate(-50%, -50%) scale(0.9) !important; transition: all 0.3s ease !important; z-index: 10000 !important; font-size: 14px !important; font-weight: 500 !important; }
.bq-toast-visible { opacity: 1 !important; transform: translate(-50%, -50%) scale(1) !important; }

.table-wrapper { background-color: white !important; border-radius: 8px !important; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important; border: 1px solid #e9ecef !important; display: flex !important; flex-direction: column !important; flex: 1 !important; overflow-x: auto !important; flex-grow: 1; }
.table-wrapper::-webkit-scrollbar { height: 8px !important; }
.table-wrapper::-webkit-scrollbar-track { background: #f1f1f1 !important; }
.table-wrapper::-webkit-scrollbar-thumb { background: #c1c1c1 !important; border-radius: 4px !important; }

.simple-table { width: 100% !important; border-collapse: collapse !important; font-size: 0.9em; }
/* FIX: Removed position:sticky and related rules to prevent layout shift */
.simple-table thead {
    z-index: 10 !important;
    background-color: #f8f9fa !important;
}
.simple-table thead tr { color: #333 !important; font-weight: bold !important; border-bottom: 2px solid #dee2e6 !important; }
.simple-table th, .simple-table td { padding: 12px 15px !important; border-bottom: 1px solid #f1f1f1 !important; white-space: nowrap !important; }
.simple-table th.sortable { cursor: pointer; position: relative; padding: 0 !important; }
.simple-table th.sortable .th-content { display: flex; align-items: center; width: 100%; height: 100%; padding: 12px 15px; }
.simple-table th.text-left.sortable .th-content { justify-content: flex-start; }
.simple-table th.text-right.sortable .th-content { justify-content: flex-end; }
.sort-indicator { display: flex; flex-direction: column; margin-left: 8px; }
.simple-table th.text-right.sortable .th-content .sort-indicator { order: -1; margin-left: 0; margin-right: 8px; }
.sort-arrow { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; opacity: 0.25; transition: opacity 0.2s; }
.sort-arrow.up { border-bottom: 5px solid #333; margin-bottom: 2px; }
.sort-arrow.down { border-top: 5px solid #333; }
.simple-table th.sorted-asc .sort-indicator .sort-arrow.up,
.simple-table th.sorted-desc .sort-indicator .sort-arrow.down { opacity: 1; }
.simple-table th { font-weight: 600 !important; }
.simple-table td { font-weight: 400 !important; }
.simple-table th.text-left, .simple-table td.text-left { text-align: left !important; }
.simple-table th.text-right, .simple-table td.text-right { text-align: right !important; }
.simple-table tbody tr:nth-child(even) { background-color: #f9f9f9 !important; }
.simple-table tbody tr:hover { background-color: #f1f8ff !important; }
.simple-table tbody td a { text-decoration: none !important; color: #217ab4 !important; font-weight: 600 !important; }
.simple-table tbody td a:hover { text-decoration: underline; color: #001f33 !important; }

.simple-table th.freeze, .simple-table td.freeze { position: sticky !important; left: 0 !important; z-index: 5 !important; box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1) !important; border-right: 1px solid #dee2e6 !important; }
.simple-table thead th.freeze { z-index: 15 !important; background-color: #f8f9fa !important; }
.simple-table tbody td.freeze { background-color: #ffffff !important; }
.simple-table tbody tr:nth-child(even) td.freeze { background-color: #f9f9f9 !important; }
.simple-table tbody tr:hover td.freeze { background-color: #f1f8ff !important; }

.loading { text-align: center !important; padding: 40px !important; color: #6c757d !important; font-style: italic !important; }

.table-wrapper.loading-overlay::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid' width='50' height='50'%3E%3Ccircle cx='50' cy='50' r='32' stroke-width='8' stroke='%23217ab4' stroke-dasharray='50.26548245743669 50.26548245743669' fill='none' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' repeatCount='indefinite' dur='1s' keyTimes='0;1' values='0 50 50;360 50 50'%3E%3C/animateTransform%3E%3C/circle%3E%3C/svg%3E") center no-repeat; z-index: 20; }

#metrics-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 10000; display: none; align-items: center; justify-content: center; }
#metrics-modal-overlay.modal-visible { display: flex !important; }
#metrics-modal { background: #fff; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); width: 90%; max-width: 450px; display: flex; flex-direction: column; height: 85vh; max-height: 700px; }
#metrics-modal .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #e9ecef; flex-shrink: 0; }
#metrics-modal .modal-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
#metrics-modal-close { font-size: 28px; font-weight: 300; color: #888; cursor: pointer; line-height: 1; }
#metrics-modal .modal-search-container { padding: 15px 20px; border-bottom: 1px solid #e9ecef; flex-shrink: 0; }
#metrics-modal-search { width: 100%; padding: 10px 12px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px; }
#metrics-modal-search:focus { border-color: #86b7fe !important; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important; outline: none; }

#metrics-modal-selected-container { padding: 15px 20px 10px; border-bottom: 1px solid #e9ecef; display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
#metrics-modal-selected-container:empty { padding: 0; border-bottom: none; }
.selected-metric-pill { display: inline-flex; align-items: center; background-color: #e2efff; color: #004085; border: 1px solid #b8daff; border-radius: 12px; padding: 4px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.selected-metric-pill .remove-metric { margin-left: 8px; cursor: pointer; font-size: 18px; line-height: 1; font-weight: bold; opacity: 0.7; }
.selected-metric-pill .remove-metric:hover { opacity: 1; }

#metrics-modal-list { overflow-y: auto; padding: 10px 0; flex-grow: 1; }
.metric-item { padding: 12px 20px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f1f1f1; }
.metric-item:last-child { border-bottom: none; }
.metric-item:hover { background-color: #f8f9fa; }
.metric-item.selected { background-color: #e2efff !important; font-weight: 600 !important; color: #004085 !important; }
.modal-footer { padding: 15px 20px; border-top: 1px solid #e9ecef; text-align: right; flex-shrink: 0; }
#metrics-modal-apply { background-color: #217ab4 !important; color: white !important; border: none !important; padding: 8px 16px !important; height: auto !important; line-height: 1.5 !important; border-radius: 4px !important; font-size: 14px !important; font-weight: 500 !important; }
#metrics-modal-apply:hover { background-color: #001f33 !important; }

@media (max-width: 768px) {
    .plugin-container { padding: 50px 10px !important; }
    .controls-container { flex-direction: column !important; gap: 25px !important; align-items: stretch !important; }
    .left-controls, .right-controls { flex-direction: column !important; align-items: stretch !important; gap: 15px !important; width: 100%; border: none !important; padding: 0 !important; margin: 0 !important; }
    .left-controls .dropdown-container:nth-child(2) { border-top: 1px solid #e9ecef !important; padding-top: 15px !important; }
    .right-controls { border-top: 1px solid #e9ecef !important; padding-top: 25px !important; }
    .right-controls .toggle-container {
        justify-content: center; /* FIX: Horizontally center the toggle on mobile */
    }
    .right-controls .action-buttons-group { border-top: 1px solid #e9ecef !important; border-left: 0px !important; padding-top: 20px !important; justify-content: space-around; }

    .simple-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 0.8em !important;
    line-height: 0.8rem !important;
}

}

/* Styles for the cloned sticky header wrapper */
.fixed-header-wrapper {
    position: fixed;
    left: 0;
    z-index: 11;
    display: none;
    overflow: hidden;
    pointer-events: none;
    background-color: #f8f9fa;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.fixed-header-wrapper table {
    border-collapse: collapse;
}

.fixed-header-wrapper .simple-table thead tr {
    border-bottom: 2px solid #dee2e6 !important;
}

.fixed-header-wrapper th {
    background-color: #f8f9fa !important;
}