/* Screener Page Specific Styles */

/* Make sure table fits within container */
#resultsTable {
    width: 100%;
    table-layout: auto;
}

/* Narrow columns for more compact display */
#resultsTable th,
#resultsTable td {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.15rem !important;
    white-space: normal !important;
    vertical-align: middle !important;
    min-width: 55px !important;
    max-width: 75px !important;
    line-height: 1.1 !important;
}

/* Company column */
#resultsTable th:first-child,
#resultsTable td:first-child {
    min-width: 90px !important;
    max-width: 90px !important;
}

/* Actions column styling */
#resultsTable th:last-child,
#resultsTable td:last-child {
    min-width: 55px !important;
    white-space: nowrap !important;
    text-align: center !important;
}

/* Make action buttons smaller and more compact */
.actions-cell .btn {
    padding: 0.1rem 0.2rem !important;
    font-size: 0.6rem !important;
    margin: 0 1px !important;
}

/* Header text wrapping */
#resultsTable th {
    height: 45px !important;
    vertical-align: middle !important;
    text-align: center !important;
    font-weight: 600 !important;
    line-height: 1.0 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    cursor: pointer;
    font-size: 0.65rem !important;
    position: relative !important;
}

/* Improve table hover effect for better readability */
#resultsTable tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075) !important;
}

/* Make rows more compact */
#resultsTable tbody tr {
    height: 30px !important;
}

/* More compact first column with ticker and name */
#resultsTable td:first-child strong {
    display: block !important;
    line-height: 1.0 !important;
    margin-bottom: 0 !important;
}

/* Styling for company selection checkbox */
.company-checkbox {
    margin-right: 5px !important;
    vertical-align: middle !important;
}

/* Make sure results container is scrollable with sticky header */
.table-responsive {
    overflow-x: auto !important;
    max-width: 100% !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
}

/* Sticky header for table */
#resultsTable thead th {
    position: sticky !important;
    top: 0 !important;
    background-color: #f8f9fa !important;
    z-index: 10 !important;
    border-bottom: 2px solid #dee2e6 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Sticky first column (Company) - stays visible when scrolling horizontally */
#resultsTable th:first-child,
#resultsTable td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 5 !important;
    background-color: #fff !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important;
}

/* First column header needs higher z-index to stay above both row headers and regular cells */
#resultsTable thead th:first-child {
    z-index: 15 !important;
    background-color: #f8f9fa !important;
}

/* Ensure alternating row colors work with sticky column */
#resultsTable tbody tr:nth-of-type(odd) td:first-child {
    background-color: #fff !important;
}

#resultsTable tbody tr:nth-of-type(even) td:first-child {
    background-color: #f8f9fa !important;
}

/* Hover state for sticky column */
#resultsTable tbody tr:hover td:first-child {
    background-color: rgba(0, 0, 0, 0.075) !important;
}

/* Reduce font size for screening criteria section */
#screenerForm .form-label {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.15rem !important;
}

#screenerForm h6.mb-3 {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
    padding-bottom: 0.25rem !important;
    margin-bottom: 0.4rem !important;
}

.slider-container {
    padding: 0 3px !important;
}

.slider-label {
    margin-top: 0.15rem !important;
    display: flex !important;
    justify-content: space-between !important;
}

.slider-label small {
    font-size: 0.6rem !important;
}

.slider-value {
    text-align: center !important;
    font-size: 0.6rem !important;
    color: #6c757d !important;
    margin-top: 1px !important;
}

/* Dual range slider styling */
.dual-range-slider {
    position: relative !important;
    height: 16px !important;
}

.dual-range-slider input[type="range"] {
    position: absolute !important;
    width: 100% !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
    z-index: 2 !important;
    background: none !important;
}

/* Give the min slider (first input) a higher z-index */
.dual-range-slider input[type="range"]:first-of-type {
    z-index: 3 !important; /* Higher than the default z-index (2) */
}

/* Make the slider track (horizontal line) thinner - only for the max slider */
.dual-range-slider input[type="range"]:last-of-type::-webkit-slider-runnable-track {
    height: 2px !important; /* 2px thick as requested */
    background: #ced4da !important; /* Light grey color */
    border: none !important;
    z-index: 1 !important; /* Ensure track is behind the thumb */
}

.dual-range-slider input[type="range"]:last-of-type::-moz-range-track {
    height: 2px !important; /* 2px thick as requested */
    background: #ced4da !important; /* Light grey color */
    border: none !important;
    z-index: 1 !important; /* Ensure track is behind the thumb */
}

.dual-range-slider input[type="range"]:last-of-type::-ms-track {
    height: 2px !important; /* 2px thick as requested */
    background: #ced4da !important; /* Light grey color */
    border: none !important;
    z-index: 1 !important; /* Ensure track is behind the thumb */
}

/* Hide the track for min slider completely */
.dual-range-slider input[type="range"]:first-of-type::-webkit-slider-runnable-track {
    height: 0px !important; /* Hidden track */
    background: transparent !important;
    border: none !important;
}

.dual-range-slider input[type="range"]:first-of-type::-moz-range-track {
    height: 0px !important; /* Hidden track */
    background: transparent !important;
    border: none !important;
}

.dual-range-slider input[type="range"]:first-of-type::-ms-track {
    height: 0px !important; /* Hidden track */
    background: transparent !important;
    border: none !important;
}

.dual-range-slider input[type="range"]::-webkit-slider-thumb {
    pointer-events: all !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    -webkit-appearance: none !important;
    z-index: 200 !important; /* Higher z-index to ensure it's above the track */
    background: #0d6efd !important;
    border: 1px solid white !important;
    position: relative !important;
    box-shadow: 0 0 0 2px white !important; /* Add white outline to ensure it covers the track */
}

.dual-range-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    z-index: 200 !important; /* Higher z-index to ensure it's above the track */
    background: #0d6efd !important;
    border: 1px solid white !important;
    position: relative !important;
    box-shadow: 0 0 0 2px white !important; /* Add white outline to ensure it covers the track */
}

/* Add for MS browsers */
.dual-range-slider input[type="range"]::-ms-thumb {
    pointer-events: all !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    z-index: 200 !important; /* Higher z-index to ensure it's above the track */
    background: #0d6efd !important;
    border: 1px solid white !important;
    position: relative !important;
    box-shadow: 0 0 0 2px white !important; /* Add white outline to ensure it covers the track */
}

/* Use thin dark lines for dividers instead of grey bars */
#screenerForm .mb-4 {
    margin-bottom: 0.6rem !important;
    border-bottom: none !important;
}

/* Improve sort indicators */
.sort-indicator {
    display: inline-block !important;
    margin-left: 2px !important;
    color: #0d6efd !important;
    font-weight: bold !important;
    font-size: 0.7rem !important;
}

/* Add sort indicator to all sortable headers */
#resultsTable th:not(:last-child)::after {
    content: "↕" !important;
    display: inline-block !important;
    margin-left: 3px !important;
    font-size: 0.65rem !important;
    color: #adb5bd !important;
    opacity: 0.7 !important;
}

/* Active sort indicator */
#resultsTable th.sort-asc::after {
    content: "↑" !important;
    color: #0d6efd !important;
    opacity: 1 !important;
}

#resultsTable th.sort-desc::after {
    content: "↓" !important;
    color: #0d6efd !important;
    opacity: 1 !important;
}

/* Hide specific unwanted elements only */
.card-body > .mb-3:has(#topCompareBtn) {
    display: none !important;
}

/* Style pagination controls to match table text size */
.card-body .d-flex.justify-content-between.align-items-center.mb-3 {
    font-size: 0.65rem !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 .form-label {
    font-size: 0.65rem !important;
    margin-bottom: 0 !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 .form-select {
    font-size: 0.65rem !important;
    padding: 0.1rem 1.2rem 0.1rem 0.3rem !important;
    height: auto !important;
    min-height: 1.5rem !important;
    width: auto !important;
    min-width: 60px !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 .text-muted {
    font-size: 0.65rem !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 .btn {
    font-size: 0.65rem !important;
    padding: 0.1rem 0.3rem !important;
    border-width: 1px !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 .form-control {
    font-size: 0.65rem !important;
    padding: 0.1rem 0.3rem !important;
}

.card-body .d-flex.justify-content-between.align-items-center.mb-3 small {
    font-size: 0.55rem !important;
}

/* Make Compare button match the "10 Years" button style */
#compareSelectedBtn {
    font-size: 0.875rem !important;
    padding: 0.375rem 0.75rem !important;
    line-height: 1.5 !important;
    border-radius: 0.375rem !important;
}

/* Adjust margins and paddings */
.card-body {
    padding: 0.4rem !important;
}

.card {
    margin-bottom: 0.4rem !important;
}

/* Better styling for the no results message */
#noResultsMessage {
    padding: 1rem 0 !important;
}

/* Smaller input fields for range inputs */
.slider-container .input-group-sm .form-control,
.slider-container .input-group-sm .input-group-text,
.filter-container .input-group-sm .form-control,
.filter-container .input-group-sm .input-group-text {
    font-size: 0.6rem !important;
    height: calc(1.2rem + 2px) !important;
    padding: 0.1rem 0.3rem !important;
}

.slider-container .mt-2,
.filter-container .mt-2 {
    margin-top: 0.25rem !important;
}

.slider-container .mx-2,
.filter-container .mx-2 {
    font-size: 0.6rem !important;
}

/* Smaller text for range display */
.smaller-text {
    font-size: 0.6rem !important;
}

/* Center the range display text */
.range-display {
    text-align: center !important;
}

/* Fix small device display */
@media (max-width: 991.98px) {
    .col-lg-3,
    .col-lg-9 {
        margin-bottom: 0.5rem !important;
    }
}
