/* ===================================================================
    Cylinder Force Calculator Stylesheet
    Final Version
====================================================================== */

/* --- Table of Contents ---
1.  General & Base Styles
2.  Form & Input Section
3.  Results Section Layout
4.  Left Column & Sticky Sidebar
5.  Machine Card Layout
6.  Description & Read More Toggle
7.  Card Buttons
8.  Performance & Chart Styling
9.  Compare Feature (Tray & Modal)
10. Mobile & Responsive Styles
---------------------------------------------------------------------- */

/* --- 1. General & Base Styles --- */
body {
    overflow: unset;
    position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 0.8em;
    color: #828282;
    line-height: 1.3;
}

h1 {
    text-align: center;
    margin-bottom: 1em;
    margin-top: 1em;
    line-height: .85em;
}

h2 {
    color: #333;
}

p {
    margin-bottom: 1em;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="checkbox"],
input[type="radio"] {
    margin-right: 5px;
    vertical-align: middle;
}

button,
.btn {
    display: inline-block;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    background-color: #eee;
    color: #333;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
.btn:hover {
    background-color: #ddd;
}

.cta-button {
    background-color: #4CAF50;
    color: white;
    width: auto;
    margin: 20px auto 0 auto;
    padding: 12px 30px;
}

.cta-button:hover {
    background-color: #45a049;
}

/* --- 2. Form & Input Section --- */
.input-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

#jobsite-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: end;
    gap: 20px;
    margin-top: 40px;
}

#jobsite-form button[type="submit"] {
    margin: 0;
}

.required {
    color: #950000;
}

.compound-input-container {
    display: flex;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.compound-input-container input[type="number"] {
    flex-grow: 1;
    padding: 8px 10px;
    border: none;
    border-right: 1px solid #ccc;
    outline: none;
    width: 70px;
    -moz-appearance: textfield;
}

.compound-input-container input[type="number"]::-webkit-outer-spin-button,
.compound-input-container input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.compound-input-container select {
    padding: 8px 10px;
    border: none;
    background-color: white;
    outline: none;
    cursor: pointer;
}

.compound-input-container:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-group {
    margin-bottom: 0px;
}

.label-with-tooltip {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tooltip-icon {
    display: inline-block;
    position: relative;
    font-weight: bold;
    color: #333;
    cursor: help;
    border: 1px solid #333;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    font-size: 0.8em;
}

.tooltip-popover {
    display: none;
    position: absolute;
    bottom: 125%;
    /* Position above the icon */
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    background-color: #333;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: normal;
    text-align: left;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tooltip-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-icon:hover .tooltip-popover,
.tooltip-icon:focus .tooltip-popover {
    display: block;
}


/* --- 3. Results Section Layout --- */
.suggested-machines-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.suggested-machines-section h4 {
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.suggested-machines-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.suggested-machine-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    width: 150px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.suggested-machine-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.suggested-machine-item h4 {
    margin-bottom: 0px;
    font-size: 14px;
}

.suggested-machine-item h6 {
    margin-top: 2px;
}

.suggested-machine-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.suggested-machine-item span {
    font-weight: bold;
    font-size: 0.9em;
}


/* New Suggested machines styling */

/* ===================================================================
    Enhanced Suggested Machines Section Styles
====================================================================== */

/* --- Main container for the section --- */
.suggested-machines-section {
    background-color: #f7f9fa;
    /* Light background to stand out */
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border-bottom: none;
    /* Remove the old line separator */
}

/* --- The section's main heading --- */
.suggested-machines-section>h4 {
    font-size: 1.4em;
    font-weight: bold;
    color: #343a40;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
}

/* --- Flex container for the cards --- */
.suggested-machines-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 25px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 15px;
}

/* --- Individual suggestion cards --- */
.suggested-machine-item {
    display: flex;
    flex-direction: column;
    text-align: center;
    text-decoration: none;
    color: #333;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    width: 170px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.suggested-machine-item:hover {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.suggested-machine-item img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    margin-bottom: 15px;
}

/* --- Text content within the card --- */
.suggested-item-info {
    margin-top: auto;
    /* Pushes text to the bottom */
}

.suggested-item-info strong {
    font-size: 1em;
    font-weight: bold;
    display: block;
    line-height: 1.3;
}

.suggested-item-info p {
    font-size: 0.85em;
    color: #6c757d;
    margin: 5px 0 0 0;
}

/* --- Styling for the "Best Match" card --- */
.suggested-machine-item.is-primary {
    border-color: #4CAF50;
    transform: scale(1.05);
    /* Make it slightly larger */
}

.suggested-machine-item.is-primary:hover {
    transform: scale(1.05) translateY(-4px);
    /* Combine effects */
}

/* --- "Best Match" badge for the primary card --- */
.best-match-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    background-color: #4CAF50;
    color: white;
    padding: 5px 12px;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 10px 0 10px 0;
}

.results-section {
    margin-top: 30px;
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-section {
    margin-top: 30px;
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

/* START: New Share Button Styles */
.results-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* For mobile */
    gap: 15px;
    margin-bottom: 10px;
    /* Space between this and the <p> tag */
}

.results-header-top h2 {
    margin: 0;
    /* Remove default margin */
    text-align: left;
    flex-grow: 1;
}

.share-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#share-results-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    padding: 8px 12px;
}

#share-feedback {
    font-size: 0.9em;
    font-weight: bold;
    color: #007bff;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#share-feedback:not(.is-hidden) {
    opacity: 1;
}

.is-hidden {
    display: none;
}

.results-controls-header {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.results-controls-header.is-visible {
    display: flex;
    opacity: 1;
    flex-direction: column;
    gap: 20px;
}

.main-content-column {
    grid-column: 2 / -1;
    /* Places this entire column on the right */
    display: flex;
    flex-direction: column;
    gap: 30px;
    /* This creates consistent spacing between the suggested section and the results list */
    min-width: 0;
}

.results-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    align-items: start;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* --- 4. Left Column & Sticky Sidebar --- */
.filter-sidebar {
    flex: 1 1 280px;
    grid-column: 1;
    position: -webkit-sticky;
    position: sticky;
    top: 110px;
    align-self: start;
}

.filter-box {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
}

.filter-button {
    background-color: #555;
    color: white;
    width: 100%;
    margin-top: 0;
    padding: 10px;
    border-radius: 0 0 5px 5px;
}

.filter-button:hover {
    background-color: #333;
}

.sidebar-controls {
    margin-top: 20px;
}

.filter-group {
    border-top: 1px solid #eee;
}

.filter-group:first-of-type {
    border-top: none;
}

.filter-group label {
    font-weight: normal;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
}

.filter-group label input {
    margin-right: 8px;
    margin-top: 0.15em;
    flex-shrink: 0;
}

.filter-group h4 {
    cursor: pointer;
    position: relative;
    padding: 15px;
    margin: 0;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group h4::after {
    content: '+';
    position: absolute;
    right: 15px;
    font-size: 1.4em;
    font-weight: bold;
}

.filter-group:not(.collapsed) h4::after {
    content: '-';
}

.filter-count-badge {
    display: none;
    background-color: #333;
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    border-radius: 10px;
    padding: 4px 6px;
    line-height: 1;
    margin-right: 25px;
}

.filter-count-badge.is-visible {
    display: inline-block;
}

.filter-options {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 15px;
}

.filter-tooltip {
    position: absolute;
    top: calc(70%);
    right: 30px;
    background-color: #000;
    color: #fff;
    padding: 8px 12px;
    padding-right: 25px;
    /* Space for the 'x' */
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: max-content;
    box-shadow: 0px 10px 10px #00000030;
    animation: fadeIn .8s;
}

/* The little triangle pointer */
.filter-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 15px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #000 transparent;
}

.close-tooltip-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px;
    line-height: 1;
    font-size: 1.2em;
    font-weight: 700;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.close-tooltip-btn:hover {
    color: #fff;
}

.filter-tooltip.is-hidden {
    display: none;
}

/* --- START: Corrected styles for blurring filters --- */
.filter-sidebar.tooltip-active .filter-group:not(:first-of-type),
.filter-sidebar.tooltip-active .filter-button {
    filter: blur(3px);
    opacity: 0.7;
    pointer-events: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.filter-sidebar.tooltip-active .filter-group:first-of-type {
    position: relative;
    z-index: 1003;
}

/* --- END: Corrected styles for blurring filters --- */


.filter-group:not(.collapsed) .filter-options {
    max-height: 500px;
    padding: 0 15px 10px 15px;
}

/* --- 5. Machine Card Layout --- */
.machine-card {
    scroll-margin-top: 110px;
}

.machine-card.new-layout {
    display: flex;
    transition: opacity 0.3s ease-in-out;
}

.card-main-content {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.card-main-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-left-column {
    flex: 1 1 300px;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.card-right-column {
    flex: 3 1 500px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    background-color: #fdfdfd;
    border-left: 1px solid #eee;
}

.card-performance-body {
    padding-top: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.5em;
}

.quick-specs {
    font-size: 1em;
    color: #A0A0A0;
    margin-bottom: 15px;
}

.machine-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 15px;
}

.machine-card.descriptive-layout .card-right-column {
    justify-content: space-between;
}

/* --- 6. Description & Read More Toggle --- */
.description-wrapper {
    position: relative;
    transition: max-height 0.4s ease-out;
}

.description-wrapper.collapsed {
    max-height: 105px;
    overflow: hidden;
}

.descriptive-layout .description-wrapper.collapsed {
    max-height: 175px;
}

.description-wrapper .description {
    margin-bottom: 0;
    padding-bottom: 2.5em;
    line-height: 1.6;
}

.toggle-description-link {
    display: block;
    text-align: right;
    font-weight: normal;
    cursor: pointer;
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
}

.toggle-description-link strong {
    font-weight: bold;
}

.description-wrapper.collapsed .toggle-description-link {
    padding-top: 30px;
    background: linear-gradient(to top, white 30%, transparent);
}

.description-wrapper:not(.collapsed) .toggle-description-link {
    background: none;
    padding-top: 5px;
    margin-top: -2.5em;
}

/* --- 7. Card Buttons --- */
.card-buttons {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn.btn-success {
    background-color: #4CAF50;
    color: white;
}

.btn.btn-success:hover {
    background-color: #45a049;
}

.btn.disabled {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- 8. Performance & Chart Styling --- */
.performance-context-title {
    font-weight: bold;
    font-size: 1.15em;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.force-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: #fdfdfd;
    overflow: hidden;
}

.force-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}

.force-section-header .force-title {
    margin: 0;
    padding: 0;
    font-size: 1.05em;
    font-weight: bold;
    color: inherit;
    text-transform: capitalize;
}

.force-section.low-force .force-section-header {
    background-color: #FFCC00;
    color: #333;
}

.force-section.medium-force .force-section-header {
    background-color: #ef5f00;
    color: white;
}

.force-section.high-force .force-section-header {
    background-color: #009900;
    color: white;
}

.force-section.low-force {
    border-color: #FFCC00;
}

.force-section.medium-force {
    border-color: #ef5f00;
}

.force-section.high-force {
    border-color: #009900;
}

.force-section-body {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
}

.force-description {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.summary-chart-container {
    margin-bottom: 10px;
}

.summary-chart-container p {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
}

.expand-force-btn {
    background: none;
    color: #007bff;
    font-size: 0.9em;
    padding: 5px 0;
    text-align: left;
}

.expand-force-btn:hover {
    background: none;
    text-decoration: underline;
}

.expanded-force-details {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

.expanded-force-title {
    font-size: 1.0em;
    margin-bottom: 15px;
    font-weight: bold;
}

.chart-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.chart-pipe-label {
    width: 70px;
    flex-shrink: 0;
    padding-right: 10px;
    text-align: right;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    line-height: 20px;
    white-space: nowrap;
}

.summary-chart .chart-pipe-label {
    display: none;
}

.chart-row-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.chart-bar-container {
    width: 100%;
}

.chart-bar {
    height: 20px;
    background-color: #e9e9e9;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    width: 100%;
}

#results-list .chart-bar {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.8s ease-out;
}

#results-list .chart-bar.animate {
    clip-path: inset(0 0 0 0);
}

.chart-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.chart-segment:last-child {
    border-right: none;
}

.chart-segment.too-small span {
    display: none;
}

.chart-bar .chart-segment.lightBlue,
#compare-modal .chart-bar .chart-segment.lightBlue {
    background-color: #ADD8E6;
    color: #333;
}

.chart-bar .chart-segment.purple,
#compare-modal .chart-bar .chart-segment.purple {
    background-color: #800080;
    color: white;
}

.chart-bar .chart-segment.red,
#compare-modal .chart-bar .chart-segment.red {
    background-color: #f44336;
    color: white;
}

.chart-dr-axis {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 5px;
    font-size: 0.75em;
    color: #666;
}

.chart-dr-axis span {
    text-align: center;
    flex: 1;
    white-space: nowrap;
}

.summary-chart .chart-dr-axis {
    font-size: 0.7em;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px 20px;
    font-size: 0.85em;
    margin-top: -25px;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 250px;
}

.legend-item .swatch {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 0.2em;
}

.swatch.lightBlue {
    background-color: #ADD8E6;
}

.swatch.purple {
    background-color: #800080;
}

.swatch.red {
    background-color: #f44336;
}

.swatch.recommended-legend {
    background-color: transparent;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- START: Updated Legend/Toggle Header Styles --- */
.card-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    background-color: #f8f9fa;
    padding: 12px 25px;
    border-bottom: 1px solid #e9ecef;
    margin-left: -25px;
    margin-right: -25px;
}

/* This was .legend-items, renamed to .legend-stack */
.legend-stack {
    display: flex;
    flex-direction: column;
    /* This stacks the legend items */
    gap: 8px;
    /* Vertical gap for stacked items */
}

.card-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.card-legend .swatch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 20%;
}

.ideal-legend .swatch {
    background-color: #ADD8E6;
}

.outside-legend .swatch {
    background-color: #f44336;
}

/* New container for the toggle and its label */
.card-toggle-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    border-left: solid 1px #ddd;
    padding-left: 30px;
}

/* New style for the "Pressure Display" label */
.card-toggle-area h4 {
    margin: 0px auto 10px;
    font-size: 1em;
    font-weight: 600;
    color: #555;
}

.card-chart-toggle {
    flex-shrink: 0;
    /* padding-top: 5px; -- removed */
}

/* Increased font size and padding for the toggle */
.toggle-option {
    position: relative;
    z-index: 2;
    padding: 7px 14px;
    /* Slightly larger */
    font-size: 0.8em;
    /* Slightly larger */
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

/* --- END: Updated Legend/Toggle Header Styles --- */

.chart-display-toggle h4 {
    margin: 0;
    font-size: 1.1em;
    color: #828282;
    font-weight: bold;
}

.toggle-switch-container {
    position: relative;
    background-color: #e9ecef;
    border-radius: 50px;
    display: flex;
    height: 38px;
    padding: 4px;
    cursor: pointer;
    border: 1px solid #dee2e6;
    width: 100%;
    box-sizing: border-box;
}

.toggle-option {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    height: 100%;
    z-index: 1;
    transition: color 0.2s ease-in-out;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    font-size: 0.8em;
}

.toggle-option.active {
    color: white;
    transition-delay: 0.1s;
}

.switch-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background-color: #4CAF50;
    border-radius: 50px;
    transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- 9. Compare & Mobile Menu --- */
.results-list.is-comparing .machine-card.not-comparable {
    opacity: 0.4;
}

.compare-section {
    margin-top: auto;
    padding-top: 15px;
    align-self: flex-end;
}

.compare-section label {
    font-weight: normal;
    font-size: 1em;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.compare-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-left: 8px;
}

.card-right-column .compare-section {
    /* padding: 0 25px 25px 25px; */
    margin-top: auto;
}

.compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s ease-out;
    z-index: 1000;
}

.compare-tray.visible {
    transform: translateY(0);
}

.compare-tray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
}

.compare-tray-header h3 {
    margin: 0;
}

.compare-tray-header div {
    display: flex;
    gap: 10px;
}

.compare-items-container {
    display: flex;
    gap: 15px;
    padding: 20px 25px;
    overflow-x: auto;
}

.compare-item {
    flex-shrink: 0;
    width: 150px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    position: relative;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.compare-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    margin-bottom: 5px;
}

.compare-item p {
    margin: 0;
    line-height: 1.2;
    height: 3.6em;
    overflow: hidden;
}

.remove-compare-item {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    border-radius: 50%;
    background-color: #333;
    color: white;
    border: 1px solid white;
    cursor: pointer;
    font-weight: bold;
}

.compare-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.compare-modal-content {
    background-color: #f5f5f5;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1200px;
    border-radius: 8px;
    position: relative;
}

.close-modal-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: black;
}

#compare-modal-body {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.compare-modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    background: transparent;
    border-bottom: 1px solid #ddd;
    margin-bottom: 25px;
    padding-bottom: 25px;
}

.compare-modal .toggle-switch-container {
    background-color: #ffffff;
}

.compare-modal .chart-pipe-label {
    display: none;
}

.values-hidden .chart-segment span {
    display: none;
}

.comparison-pipe-size-group h3 {
    color: #333;
}

.comparison-item-section {
    margin-bottom: 30px;
}

.comparison-item-section:last-of-type {
    margin-bottom: 0;
}

.comparison-item-section h5 {
    margin-bottom: 0.5em;
    font-weight: bold;
}

.comparison-nav {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.comparison-nav h4 {
    margin-bottom: 10px;
}

.comparison-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.comparison-nav-links a {
    display: block;
    padding: 8px 12px;
    background-color: #ffffff;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    border: 1px solid #ddd;
}

.comparison-nav-links a:hover {
    background-color: #f0f0f0;
}

.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background-color: #333;
    color: white;
    padding: 12px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.close-filters-btn {
    display: none;
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 30px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
}

.close-filters-btn:hover {
    color: #000;
}

#back-to-top-button {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #007041;
    color: white;
    cursor: pointer;
    padding: 15px 15px 5px 15px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.4s, visibility 0.4s;
    visibility: hidden;
}

#back-to-top-button.visible {
    display: block;
    opacity: 1;
    visibility: visible;
}

#back-to-top-button:hover {
    background-color: #029256;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        top: calc(120%);
    }

    100% {
        opacity: 1;
        top: calc(70%);
    }
}

/* --- 10. Responsive Media Queries --- */
@media (max-width: 900px) {
    .results-layout {
        display: block;
    }

    .suggested-machines-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        overflow-x: hidden;
        padding: 10px;
        padding-bottom: 0;
    }

    .suggested-machine-item {
        width: 100%;
        flex-shrink: 1;
    }

    .mobile-filter-btn {
        display: flex;
    }

    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        width: 300px;
        height: 100vh;
        z-index: 1002;
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        border-radius: 0;
        border-right: 1px solid #ccc;
        background-color: #FFF;
    }

    .filter-sidebar.is-open {
        transform: translateX(0);
    }

    .close-filters-btn {
        display: block;
    }

    #jobsite-form {
        flex-direction: column;
        align-items: stretch;
        gap: 25px;
    }

    #jobsite-form .form-group,
    #jobsite-form button[type="submit"] {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .card-main-content {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .card-left-column,
    .card-right-column {
        flex-basis: 100%;
        min-width: 100%;
        padding: 15px;
    }

    .card-right-column {
        border-left: none;
        border-top: 1px solid #eee;
        margin-top: 20px;
        padding-top: 20px;
    }
    .results-header-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .results-header-top h2 {
        text-align: center;
    }
    .card-toggle-area {
        border-left: none;
        padding-left: 0px;
    }
}

@media (max-width: 600px) {
    .chart-pipe-label {
        display: none;
    }
}