/* Product Finder - CSS */

.fes-pf-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.fes-pf-container {
    text-align: left;
    margin-bottom: 40px;
}

.fes-pf-intro {
    margin-bottom: 30px;
    text-align: center;
}

.fes-pf-sub {
    color: #d40606;
    font-size: 12px;
    letter-spacing: 3px;
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.fes-pf-main-title {
    font-size: 48px;
    font-weight: 900;
    color: #050a30;
    line-height: 1.1;
    margin: 0 0 10px 0;
    letter-spacing: -1px;
}

/* Search Bar - Horizontal Layout */
.fes-pf-search-bar {
    background: #fff !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    border: none !important;
    border-radius: 4px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 15px !important;
    margin: 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

.fes-pf-bar-block {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 8px 20px !important;
    text-align: left !important;
    cursor: pointer;
    transition: background 0.2s;
    border-right: none !important;
    width: auto !important;
    float: none !important;
    position: relative !important;
}

/* Vertical divider using pseudo-element (shorter) */
.fes-pf-bar-block::after {
    content: '' !important;
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 1px !important;
    height: 30px !important;
    background: #ddd !important;
}

/* .fes-pf-bar-block:last-of-type::after {
    display: none !important;
} */


.fes-pf-block-label {
    display: block;
    font-size: 10px;
    color: #999;
    font-weight: 600;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.fes-pf-block-val {
    display: block;
    font-size: 13px;
    color: #050a30;
    font-weight: 700;
}

.fes-pf-bar-divider {
    display: none !important;
}

.fes-pf-bar-btn-wrap {
    margin-top: 15px;
    flex: 1 1 auto !important;
    display: flex !important;
    padding: 0 0 0 5px !important;
    align-items: center;
    justify-content: flex-start;
    width: 12%;
}

.fes-pf-btn-submit-trigger {
    background: #d40606 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 15px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    width: 100% !important;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap !important;
}

.fes-pf-btn-submit-trigger:hover {
    background: #b30505 !important;
    transform: translateY(-1px);
}

/* Modal Adjustments */
.fes-pf-modal-container {
    max-width: 600px;
}

/* Modal */
.fes-pf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8) !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999999 !important;
    /* Extremely high to stay on top */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Lock scroll when modal is active */
html.fes-pf-lock-scroll,
body.fes-pf-lock-scroll {
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
    position: fixed !important;
    /* Forces lock on some mobile browsers */
}

.fes-pf-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fes-pf-modal-container {
    margin-top: 150px;
    background: #fff;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.fes-pf-modal-header {
    background: #050a30;
    color: #fff;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fes-pf-modal-header h3 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 1px;
    color: #fff;
}

.fes-pf-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

.fes-pf-modal-body {
    padding: 30px;
    overflow-y: auto !important;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    /* For better mobile scrolling */
}

.fes-pf-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.fes-pf-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: #050a30;
    margin-bottom: 25px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fes-pf-indicator {
    color: #d40606;
    font-weight: 900;
}

.fes-pf-field {
    margin-bottom: 25px;
}

.fes-pf-field label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}

.fes-pf-price-display {
    font-size: 24px;
    font-weight: bold;
    color: #050a30;
    margin-bottom: 10px;
}

.fes-pf-price-display small {
    font-size: 12px;
    color: #999;
}

/* Range Slider Custom Styling */
.fes-pf-range {
    /* -webkit-appearance: none; */
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.fes-pf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #d40606;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.fes-pf-input-text,
.fes-pf-input-year {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    font-size: 14px;
    border-radius: 4px;
}

/* Toggle Buttons */
.fes-pf-toggle-group {
    display: flex;
    gap: 10px;
}

.fes-pf-toggle-btn {
    flex: 1;
    background: #fff;
    border: 1px solid #ccc;
    padding: 8px 0;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
}

.fes-pf-toggle-btn:hover {
    border-color: #050a30;
}

.fes-pf-toggle-btn.active {
    background: #fff;
    border-color: #050a30;
    color: #050a30;
    box-shadow: inset 0 0 0 1px #050a30;
}

/* Feng Shui Box */
.fes-pf-fengshui-box {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 4px;
}

.fes-pf-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 15px;
    font-style: italic;
}

.fes-pf-year-input-wrap {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.fes-pf-input-year {
    border-radius: 4px 0 0 4px;
}

.fes-pf-btn-calc {
    background: #050a30;
    color: #fff;
    border: none;
    padding: 0 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
}

.fes-pf-elements-list {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.fes-pf-element-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
}

.fes-pf-element-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: all 0.3s ease;
    padding: 6px;
}

.fes-pf-element-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: none;
    /* Show original colors */
    opacity: 0.8;
    transition: all 0.3s ease;
}

.fes-pf-element-label {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.fes-pf-element-item:hover .fes-pf-element-icon {
    border-color: #050a30;
}

.fes-pf-element-item.active .fes-pf-element-icon {
    border-color: #050a30;
}

.fes-pf-element-item.active .fes-pf-element-icon img {
    opacity: 1;
}

.fes-pf-element-item.active .fes-pf-element-label {
    color: #050a30;
    font-weight: 700;
}

/* Footer */
.fes-pf-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fes-pf-btn-link {
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.fes-pf-btn-link:hover {
    color: #d40606;
}

.fes-pf-btn-submit {
    background: #d40606;
    color: #fff;
    border: none;
    padding: 15px 40px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s, background 0.2s;
}

.fes-pf-btn-submit:hover {
    background: #b30505;
    transform: translateY(-2px);
}

/* Results Display - Synced with other features in style.css */
#fes-pf-main-results {
    margin-top: 40px;
}



/* Loading State */
.fes-pf-loading {
    padding: 40px;
    text-align: center;
}

.fes-pf-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pfSpin 0.8s linear infinite;
    display: inline-block;
}

@keyframes pfSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive - Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .fes-pf-wrapper {
        padding: 0 15px !important;
    }

    .fes-pf-main-title {
        font-size: 28px !important;
    }

    .fes-pf-bar-block {
        padding: 10px 15px !important;
    }

    .fes-pf-block-val {
        font-size: 12px !important;
    }

    .fes-pf-btn-submit-trigger {
        padding: 10px 20px !important;
        font-size: 12px !important;
    }

    /* Modal */
    .fes-pf-filter-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .fes-pf-modal-container {
        max-width: 90%;
    }
}

/* Responsive - Mobile (max-width: 430px) */
@media (max-width: 430px) {
    .fes-pf-container {
        text-align: center !important;
    }

    .fes-pf-intro {
        margin-bottom: 25px !important;
    }

    .fes-pf-sub {
        font-size: 10px !important;
        letter-spacing: 2px !important;
    }

    .fes-pf-main-title {
        font-size: 24px !important;
        line-height: 1.3 !important;
    }

    /* Search bar vertical stack */
    .fes-pf-search-bar {
        flex-direction: column !important;
        padding: 0 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    .fes-pf-bar-block {
        width: 100% !important;
        padding: 15px 20px !important;
        border-bottom: 1px solid #eee !important;
        border-right: none !important;
    }

    .fes-pf-bar-block::after {
        display: none !important;
    }

    .fes-pf-bar-block:last-of-type {
        border-bottom: none !important;
    }

    .fes-pf-bar-btn-wrap {
        width: 100% !important;
        padding: 15px !important;
    }

    .fes-pf-btn-submit-trigger {
        width: 100% !important;
        padding: 15px 20px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
    }

    /* Modal Mobile Optimization */
    .fes-pf-modal-container {
        width: 100%;
        height: 100% !important;
        /* Take full height on very small screens if needed, or stick to 82% */
        height: 85vh !important;
        max-height: 100%;
        border-radius: 12px 12px 0 0;
        margin-top: auto !important;
        /* Slide up from bottom */
    }

    .fes-pf-modal-header {
        padding: 15px 20px;
    }

    .fes-pf-modal-header h3 {
        font-size: 18px;
        text-align: center;
        flex: 1;
    }

    .fes-pf-modal-close {
        position: absolute;
        right: 15px;
        top: 12px;
        font-size: 24px;
        width: 32px;
        height: 32px;
        line-height: 28px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .fes-pf-modal-body {
        padding: 20px;
    }

    .fes-pf-filter-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .fes-pf-modal-footer {
        padding: 15px 20px;
        flex-direction: row;
        /* Keep row but slim down if possible */
        gap: 10px;
    }

    .fes-pf-btn-submit {
        padding: 12px 20px;
        font-size: 14px;
        flex: 2;
        white-space: nowrap;
        /* Prevent wrapping */
    }

    .fes-pf-btn-link {
        font-size: 11px;
        flex: 1;
        text-align: left;
    }

    .fes-pf-toggle-group {
        display: flex;
        flex-wrap: nowrap;
        /* Prevent buttons from wrapping to next line */
        overflow-x: auto;
        padding-bottom: 5px;
        gap: 8px;
    }

    .fes-pf-toggle-btn {
        flex: 1 0 auto;
        padding: 10px 15px;
        font-size: 13px;
        white-space: nowrap;
    }

    .fes-pf-element-label {
        font-size: 10px;
    }
}