#mobile-search-icon,
.main-menu .header-search-wrapper {
    display: none !important;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Lato', sans-serif !important;
    font-weight: 300;
    background-color: #f2f2f2;
    overflow-x: hidden;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}


.screener-plugin-wrapper {
    margin-inline: auto;
    max-width: none !important;
    margin-left: initial !important;
    margin-right: initial !important;
}

.screener-plugin-container {
    max-width: 1600px;
    background-color: #f2f2f2;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-top: 100px;
    margin-bottom: 70px;
}

.screener_table_pane,
.extrafilters {
    background: white;
    margin: 10px;
    padding: 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.data-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.header-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#mobile-industry-filter {
    display: none;
}

#data-table-title {
    margin: 0;
}


#historic-data-wrapper {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.styled-table {
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
    width: 100%;
}

.styled-table thead tr {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
}

.styled-table th {
    text-align: left;
}

.styled-table th.text-right {
    text-align: right;
}

.styled-table th,
.styled-table td {
    padding: 8px 15px;
    border-bottom: 1px solid #f1f1f1;
    white-space: nowrap;
    vertical-align: middle;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f9f9f9;
}

.styled-table tbody tr:hover {
    background-color: #f1f8ff;
    color: #004085;
}

.styled-table tbody tr:last-of-type {
    border-bottom: none;
}

.styled-table th.sortable {
    cursor: pointer;
}

.styled-table th.sortable span {
    vertical-align: middle;
}

.sort-indicator {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
}

.styled-table th:not(.text-right) .sort-indicator {
    margin-left: 8px;
}

.styled-table th.text-right .sort-indicator {
    margin-right: 8px;
}

.sort-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.25;
}

.sort-arrow.up {
    border-bottom: 5px solid #333;
    margin-bottom: 2px;
}

.sort-arrow.down {
    border-top: 5px solid #333;
}

.styled-table th.sorted-asc .sort-indicator .sort-arrow.up,
.styled-table th.sorted-desc .sort-indicator .sort-arrow.down {
    opacity: 1;
}

#pagination-controls {
    padding: 15px 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    color: #6c757d;
    flex-wrap: wrap;
}

.btn-pagination {
    background-color: #217ab4;
    color: white;
    border: none;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-pagination:hover:not(:disabled) {
    background-color: #001f33;
}

.btn-pagination:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#pageInfo {
    font-size: 14px;
    color: #333;
    margin: 0 15px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
}

.rows-per-page-container {
    display: flex;
    align-items: center;
}

#rows-per-page-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
    border: 1px solid #767676;
    color: #333;
    font-weight: normal;
    border-radius: 6px;
    padding: 6px 30px 6px 12px;
    font-size: 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px 12px;
}


.valueInput,
#metrics-modal-search,
#rows-per-page-select {
    outline: none !important;
}

.valueInput:focus,
#metrics-modal-search:focus,
#rows-per-page-select:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}


.button button,
.btn-download-table {
    color: #4a4a4a;
    background: white;
    border: 1px solid #dbdbdb;
    margin-inline: 0;
    cursor: pointer;
    border-radius: 4px;
    min-height: 38px;
    font-size: 14px;
    padding: 7px 15px;
    transition: all ease-in-out 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.button button:hover,
.btn-download-table:hover {
    color: #363636;
    border-color: #b5b5b5;
    background: #f5f5f5;
}

.template,
.industryFiltercontainer {
    display: flex;
    align-items: center;
    gap: 0; /* Changed from 15px to 0 for desktop */
}

.valueInput {
    height: 38px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 14px;
}

.valueInput[type=number] {
    -moz-appearance: textfield !important;
}

.valueInput[type=number]::-webkit-inner-spin-button,
.valueInput[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: auto !important;
    opacity: 1 !important;
    cursor: pointer;
}

.valueInput[type=number] {
    padding-right: 15px !important;
}

#addFilterButton {
    background: #217ab4;
    border: none;
    color: white;
    font-size: 20px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    height: 29px;
    width: 29px;
    line-height: 29px;
    padding: 0;
    text-align: center;
    transition: background-color 0.2s;
}

#addFilterButton:hover {
    background: #001f33;
}

.removeFilterButton {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    margin-left: 10px; /* Add some space */
}

.removeFilterButton:hover {
    color: #333;
}

.extrafilter_buttonContainer {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.styled-table th.freeze,
.styled-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;
}

.styled-table thead th.freeze {
    z-index: 15 !important;
    background-color: #f8f9fa !important;
}

.styled-table tbody td.freeze {
    background-color: #ffffff !important;
}

.styled-table tbody tr:nth-of-type(even) td.freeze {
    background-color: #f9f9f9 !important;
}

.styled-table tbody tr:hover td.freeze {
    background-color: #f1f8ff !important;
}

.styled-table thead th {
    position: sticky;
    background-color: #f8f9fa;
    z-index: 10;
}

.mobile-metrics-container {
    display: none;
    background: white;
    margin: 10px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    flex-direction: column;
    gap: 15px;
}

#mobile-select-metrics-btn {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    margin-bottom: 0;
    background-color: #217ab4;
    color: white;
    border: none;
    font-weight: 500;
}

.pills-display-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    min-height: auto;
}

.pills-display-container:empty {
    display: none;
}

#metrics-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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-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;
    transition: background-color 0.2s;
}

.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;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer;
}

#metrics-modal-selected-container {
    padding: 5px 20px 10px;
    border-bottom: 1px solid #e9ecef;
    max-height: 140px;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#metrics-modal-selected-container:empty {
    padding: 0;
    border-bottom: none;
}

.metric-filter-controls {
    padding: 10px 15px 15px 15px;
    background-color: #f7f7f7;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

.metric-filter-controls .ts-wrapper {
    flex: 1 1 35%;
    min-width: 0;
}

.metric-filter-controls .valueInput {
    flex: 1 1 30%;
    min-width: 0;
}

.condition-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    background-color: #e2efff;
    color: #004085;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    gap: 8px;
    transition: background-color 0.2s, border-color 0.2s;
}

.condition-pill.active,
.condition-pill:hover {
    background-color: #cce5ff;
    border-color: #007bff;
}

.condition-pill .edit-icon {
    font-size: 14px;
    color: #004085;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.condition-pill:hover .edit-icon {
    opacity: 1;
}

.condition-pill .remove-condition {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    color: #004085;
    opacity: 0.7;
}

.mobile-edit-controls-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-edit-controls-header {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.mobile-edit-controls-header strong {
    color: #217ab4;
}

.mobile-edit-controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mobile-edit-controls-row .ts-wrapper {
    flex: 1 1 30%;
    min-width: 0;
}

.mobile-edit-controls-row .valueInput {
    flex: 1 1 40%;
    min-width: 0;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #217ab4;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}


@media screen and (max-width: 768px) {
    .screener-plugin-container {
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .screener_table_pane,
    .extrafilters,
    .mobile-metrics-container {
        padding: 15px;
    }

    .data-table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .toggle-container {
        display: flex;
        order: -1;
        width: 100%;
        justify-content: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #f1f1f1;
        margin-bottom: 10px;
    }

    .screener_table_pane {
        display: flex;
        flex-direction: column;
        margin-bottom: 60px;
    }

    #mobile-industry-filter {
        display: block;
        order: 1;
        margin-bottom: 15px;
    }

    #data-table-container {
        order: 2;
    }

    #data-table-title {
        order: 1;
        text-align: center;
    }

    .header-controls-right {
        order: 2;
        display: flex;
        gap: 10px;
        width: 100%;
        flex-wrap: wrap;
    }

    .header-controls-right .button {
        flex: 1;
    }

    .header-controls-right .button button,
    .header-controls-right .button a {
        width: 100%;
        justify-content: center;
    }

    #desktop-industry-filter {
        display: none;
    }

    .mobile-metrics-container {
        display: flex;
        margin-top: 60px;
    }

    .template {
        display: none;
    }

    #addFilterButton {
        display: none !important;
    }

    #metrics-modal-list {
        padding: 0;
    }

    .metric-item {
        border-bottom: none;
    }

    .metric-item-container {
        border-bottom: 1px solid #f1f1f1;
    }

    .filter-controls-row {
        display: flex;
        width: 100%;
        gap: 5px;
        align-items: center;
    }

    .filter-controls-row .ts-wrapper {
        flex: 1 1 30%;
        width: auto !important;
        min-width: 0;
        margin: 0 !important;
    }

    .filter-controls-row .valueInput {
        flex: 1 1 40%;
        width: auto !important;
        min-width: 0;
        margin: 0 !important;
        height: 38px;
    }

    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }

    .pagination-buttons {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    #mobile-industry-filter .ts-wrapper {
        width: 100% !important;
        max-width: 100%;
    }

    .metric-filter-controls .valueInput[type=number],
    .mobile-edit-controls-row .valueInput[type=number] {
        -webkit-appearance: textfield !important;
        -moz-appearance: textfield !important;
    }
}

@media screen and (min-width: 769px) {
    .template {
        display: flex;
        align-items: center;
        gap: 0;
    }

    .template .metric-select-button {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        background-color: #f2f7fa;
        border: none;
        border-bottom: 1px solid #72c4f9;
        border-radius: 2px;
        height: auto;
        line-height: 28px;
        font-size: 15px;
        width: 486px;
        margin: 5px 0 5px 5px; /* Adjust margin */
        padding: 0 30px 0 10px;
        text-align: left;
        cursor: pointer;
    }
    
    /* CRITICAL FIX: Add flexbox styles for horizontal alignment */
    .template .filter-controls-row {
        display: flex;
        align-items: center;
        gap: 0;
    }

    .template .ts-wrapper {
        margin: 10px 0 5px 28px;
        width: 235px !important;

    }

    .template .ts-control {
        background-color: #f2f7fa !important;
        border: none !important;
        border-bottom: 1px solid #72c4f9 !important;
        border-radius: 2px !important;
        height: 29px !important;
        padding-top: 2px;
        font-size: 15px;
        min-height: auto;
    }
    
    .template .ts-control input::placeholder {
        color: #333 !important;
    }

    .template .valueInput {
        background-color: #f2f7fa;
        height: 29px !important;
        border: none;
        border-bottom: 1px solid #72c4f9;
        border-radius: 2px;
        width: 200px !important;
        margin: 5px 0 5px 28px; /* Adjust margin */
        font-size: 15px;
    }
}

.screener_table_pane.loading-overlay {
    position: relative;
    overflow: hidden;
}

.screener_table_pane.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 99;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid' width='50' height='50' style='shape-rendering: auto; display: block; background: transparent;' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%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%3Cg%3E%3C/g%3E%3C/g%3E%3C!-- [ldio] generated by https://loading.io/ --%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: opacity 0.2s ease-in-out;
}

.fixed-header-wrapper {
    position: fixed;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.fixed-header-wrapper th {
    font-size: 14px !important;
}

.fixed-header-wrapper.sticky-active {
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transform: translateZ(0);
}

.fixed-header-wrapper .cloned-table {
    table-layout: fixed;
    transition: none;
}

.fixed-header-wrapper .frozen-column {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1001;
    background-color: #f8f8f8;
    box-shadow: 0 0 2px rgba(0,0,0,0.02);
    border-right: 1px solid rgba(0,0,0,0.01);
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.2s ease;
}

.fixed-header-wrapper .frozen-column.show {
    opacity: 1;
    transform: translateX(0);
}

.fixed-header-wrapper .frozen-column th {
    padding: 10px;
    text-align: left;
    font-weight: bold;
    box-sizing: border-box;
}

#runScreenerButton {
    min-height: 29px; 
    height: 29px;
    padding: 0 15px;
    margin-left: -5px; 
}

#runScreenerButton:disabled {
    background-color: #cccccc;
    border-color: #cccccc;
    color: #666;
    cursor: not-allowed;
}

#runScreenerButton:disabled:hover {
    background: #cccccc;
    border-color: #cccccc;
    color: #666;
}

/* Tom Select Customizations */
.ts-wrapper .ts-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: none;
    font-size: 14px;
    padding: 6px 12px;
}

.ts-wrapper.multi.has-items .ts-control {
    padding: 6px 12px 3px 12px;
}

.ts-wrapper.focus .ts-control {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.ts-wrapper.multi .ts-control > div {
    background: #007bff;
    color: white;
    border: 1px solid #006fe6;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 500;
}

.ts-wrapper.multi .ts-control > div .remove {
    border-left: 1px solid #0062cc;
    margin-left: 6px;
    padding-left: 6px;
    font-size: 14px;
}

.ts-wrapper .ts-dropdown {
    z-index: 10050;
    border-color: #ced4da;
}

/* CRITICAL FIX: Add direct selector for dropdowns appended to body */
.ts-dropdown {
    z-index: 10050 !important;
}

.ts-wrapper .ts-dropdown .active {
    background-color: #217ab4;
    color: white;
}

.metric-filter-controls .ts-control, .mobile-edit-controls-row .ts-control {
    text-align: left;
}


