:root {
    --pb-default: #1fc066;
    --pb-grey: #dedede;
    --pb-dark-grey: #a7a7a7;
}

/* Product Builder Styles */
.product-builder-wrapper {
    margin: 50px 0;
}

.product-builder-group {
    margin-bottom: 14px;
}

.product-builder-title {
    margin: 50px 0 20px;
    font-size: 22px;
    font-weight: normal;
}

.selection-type-hint {
    font-size: 14px; /* Smaller than the title */
    font-weight: normal; /* Less emphasis */
    color: #777; /* Grey color for subtle appearance */
    margin-left: 8px; /* Space between title and hint */
    display: inline-block; /* Keep on same line as title */
}

/* Radio and Checkbox Styles */
.product-builder-radio-label,
.product-builder-checkbox-label {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
    color: #000;
}

/* Input and Modal Areas */
.modal-area {
    flex: 0 0 85%;
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}

.input-area {
    flex: 0 0 15%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    cursor: pointer;
    position: relative;
    border-left: 1px solid var(--pb-grey);
}

/* Responsive adjustments for mobile screens */
@media (max-width: 768px) {
    .modal-area {
        flex: 0 0 75%; /* More space for inputs on mobile */
    }
    
    .input-area {
        flex: 0 0 25%;
    }
}

/* Additional adjustments for very small screens */
@media (max-width: 480px) {
    .modal-area {
        flex: 0 0 70%;
    }
    
    .input-area {
        flex: 0 0 30%;
    }
}

/* Hover effects for modal area */
.modal-area:hover .product-builder-radio-name,
.modal-area:hover .product-builder-checkbox-name {
    text-decoration: underline;
}

/* Radio Container Styles */
.input-area .radio-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: relative;
    z-index: 5;
}

/* Radio Input Styles */
.input-area .product-builder-radio {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    margin: 0 auto !important; /* Center horizontally */
    padding: 0 !important;
    background-color: #fff !important;
    border: solid 2px var(--pb-grey) !important;
    border-radius: 50% !important;
    transition: all .3s ease !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    position: relative !important;
    z-index: 10 !important; /* Ensure radio is above other elements */
}

.input-area .product-builder-radio:hover {
    border-color: var(--pb-dark-grey) !important;
}

.input-area .product-builder-radio:focus {
    outline: none !important;
    border-color: var(--pb-default) !important;
    box-shadow: 0 0 0 1px var(--pb-default) !important;
}

.input-area .product-builder-radio::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background: transparent !important;
    transition: all .3s ease !important;
}

.input-area .product-builder-radio:checked {
    border-color: var(--pb-default) !important;
    background-color: #fff !important;
}

.input-area .product-builder-radio:checked::after {
    background-color: var(--pb-default) !important;
}

/* Checkbox Switch Styles */
.input-area .product-builder-checkbox-switch {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    width: 80px;
    height: 34px;
    z-index: 4;
    margin: 0 auto; /* Center in container */
}

/* Adjust checkbox switch width on mobile */
@media (max-width: 768px) {
    .input-area .product-builder-checkbox-switch {
        width: 70px; /* Slightly smaller on mobile */
    }
    
    input:checked + .product-builder-checkbox-slider:before {
        transform: translateX(36px); /* Adjust for smaller width */
    }
}

/* Clickable Areas */
.product-builder-radio-flex,
.product-builder-checkbox-flex {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #fff;
    outline: 1px solid var(--pb-grey);
    cursor: pointer;
    transition: outline-color .3s ease, transform .2s ease;
}

.product-builder-radio-flex:hover,
.product-builder-checkbox-flex:hover {
    z-index: 2;
    outline-color: var(--pb-dark-grey);
}

input:checked ~ .product-builder-radio-flex,
input:checked ~ .product-builder-checkbox-flex {
    z-index: 3;
    outline: 2px solid var(--pb-default);
}

/* Make image and title clickable */
.product-builder-radio-image,
.product-builder-checkbox-image,
.product-builder-radio-name,
.product-builder-checkbox-name {
    cursor: pointer;
}

.product-builder-radio-image,
.product-builder-checkbox-image {
    flex-shrink: 0;
}

.product-builder-radio-image img,
.product-builder-checkbox-image img {
    width: 60px;
    height: auto;
    margin-right: 14px;
}

.product-builder-radio-info,
.product-builder-checkbox-info {
    flex-grow: 1;
}

.product-builder-radio-name,
.product-builder-checkbox-name {
    font-size: 16px;
    transition: all 0.2s ease;
}

.product-builder-radio-name:hover,
.product-builder-checkbox-name:hover {
    text-decoration: underline;
}

.product-builder-radio-info,
.product-builder-checkbox-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-builder-radio-stock,
.product-builder-checkbox-stock {
    font-size: 14px;
    color: #4b4b4b;
    margin: 2px 0;
}

/* Override WooCommerce stock styles */
.stock-wrapper * {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

.stock-wrapper p {
    margin-block-start: 0 !important;
    margin-block-end: 0 !important;
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
}

.product-builder-radio-price,
.product-builder-checkbox-price {
    font-size: 16px;
    font-weight: bold;
    margin: 2px 0;
}

/* Fancy Slider Switch */
.product-builder-checkbox-switch {
    position: relative;
    display: flex;
    align-items: center;
    width: 80px;
    height: 34px;
    z-index: 4;
}

.product-builder-checkbox-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.product-builder-checkbox-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f83d04;
    transition: .3s;
    border-radius: 34px;
}

.product-builder-checkbox-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .product-builder-checkbox-slider {
    background-color: var(--pb-default);
}

input:checked + .product-builder-checkbox-slider:before {
    transform: translateX(46px);
}

.product-builder-checkbox-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 6px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.product-builder-checkbox-status.status-yes {
    opacity: 0;
    padding-right: 22px;
}

.product-builder-checkbox-status.status-no {
    opacity: 1;
    padding-left: 22px;
}

input:checked ~ .product-builder-checkbox-status.status-yes {
    opacity: 1;
}

input:checked ~ .product-builder-checkbox-status.status-no {
    opacity: 0;
}

/* Select2 Customization */
.product-builder-wrapper .select2-container--default .select2-selection--single {
    height: 44px;
    margin: 0;
    padding: 0;
    background: #fff;
    border: solid 1px var(--pb-grey);
    border-radius: 0;
    font-size: 16px;
    color: #000;
    cursor: pointer;
}

.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 50px 0 14px;
    line-height: 42px;
}

.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__placeholder,
.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #000;
}

/* Hide default Select2 elements */
.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow b,
.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__clear {
    display: none !important;
}

/* Custom arrow styling */
.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-builder-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow::after {
    content: '';
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transform: translateY(0);
    transition: transform 0.2s ease;
}

.product-builder-wrapper .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow::after {
    transform: rotate(180deg);
}

/* Fix dropdown positioning */
.select2-container--open .select2-dropdown {
    margin-top: 1px !important;
    border-color: var(--pb-grey);
}

.select2-container--open .select2-dropdown--below {
    border-top: 1px solid var(--pb-grey);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.select2-container--open .select2-dropdown--above {
    border-bottom: 1px solid var(--pb-grey);
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

/* Improve dropdown interaction */
.select2-container {
    z-index: 100000;
}

.select2-dropdown {
    z-index: 100001;
}

.select2-dropdown.product-builder-dropdown {
    margin: -1px 0 0;
    background: #fff;
    border: solid 1px var(--pb-grey);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.select2-container--default .product-builder-dropdown .select2-results__option {
    padding: 10px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.select2-container--default .product-builder-dropdown .select2-results__option--highlighted[aria-selected] {
    background: var(--pb-grey);
    color: #000;
}

.select2-container--default .select2-results > .select2-results__options {
    max-height: 300px;
}

/* Prevent text selection */
.select2-selection__rendered,
.product-builder-option {
    user-select: none;
}

/* Fix dropdown positioning */
.select2-container--open .select2-dropdown--below {
    margin-top: 1px;
}

.select2-dropdown.product-builder-dropdown {
    margin: -1px 0 0;
    background: #fff;
    border: solid 1px var(--pb-grey);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.select2-container--default .product-builder-dropdown .select2-results__option--highlighted[aria-selected] {
    background: var(--pb-grey);
    color: #000;
}

.product-builder-dropdown .select2-results__option {
    padding: 10px 14px;
}

.product-builder-option {
    opacity: 0.75;
}

.select2-results__option--highlighted .product-builder-option {
    opacity: 1;
}

.product-builder-option,
.product-builder-option-info {
    display: flex;
    align-items: center;
}

.product-builder-option-left {
    flex-grow: 1;
}

.product-builder-option-info {
    font-size: 16px;
    color: #000;
}

.product-builder-option-right {
    font-size: 16px;
    color: #000;
}

/* Summary Section */
.product-builder-summary {
    margin: 30px 0;
    padding: 25px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    transition: all 0.3s ease;
    outline: 1px solid var(--pb-dark-grey);
}

#product-builder-selected {
    margin-bottom: 20px;
}

#product-builder-selected .title {
    margin: 0 0 8;
    font-size: 18px;
    font-weight: 600;
    color: #222;
    display: inline-block;
}

#product-builder-selected ul {
    display: block;
    margin: 5px 0 0 0;
    padding: 0;
    list-style: none;
}

#product-builder-selected li {
    position: relative;
    font-size: 16px;
    color: #000;
    padding: 12px 0 12px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

#product-builder-selected li:last-child {
    border-bottom: none;
}

#product-builder-selected li svg {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
}

#product-builder-selected li [fill] {
    fill: var(--pb-default);
}

#product-builder-total,
#product-builder-total-without-tax {
    margin-top: 15px;
    padding: 15px 0 0 0;
    border-top: 2px solid var(--pb-grey);
    background-color: rgba(255, 255, 255, 0.7);
    font-size: 22px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#product-builder-total-without-tax {
    margin-top: 10px;
    padding-top: 15px;
    font-size: 16px;
    font-weight: 400;
    color: #666;
    border-top: 1px solid var(--pb-grey);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .product-builder-summary {
        padding: 20px 15px;
    }
    
    #product-builder-selected .title {
        font-size: 16px;
    }
    
    #product-builder-total {
        font-size: 20px;
    }
    
    #product-builder-total-without-tax {
        font-size: 14px;
    }
}

/* Quote Button Styles */
.product-builder-quote-button {
    margin-top: 22px;
    padding: 20px 0 13px;
}

.product-builder-wrapper .product-builder-quote-button button {
    display: inline-block;
    padding: 20px 40px;
    background-color: #f83d04;
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.product-builder-wrapper .product-builder-quote-button button:hover {
    background-color: #000;
}

/* Utility Classes */
:where(.row) {
    --gutter: 20px;
    display: flex;
    flex-wrap: wrap;
    margin-right: calc(-1 * var(--gutter));
    margin-left: calc(-1 * var(--gutter));
}

:where(.row > *) {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: var(--gutter);
    padding-left: var(--gutter);
}

:where(.col) {
    flex: 1 0 0%;
}

:where(.col-auto) {
    flex: 0 0 auto;
    width: auto;
}

:where(.d-flex) {
    display: flex;
}

:where(.align-items-start) {
    align-items: flex-start;
}

:where(.flex-column) {
    flex-direction: column;
}

:where(.mt-auto) {
    margin-top: auto;
}

/* Modal Styles */
.nmnwcpo-modal-header {
    position: relative;
    padding: 24px 24px 0;
    border-bottom: 1px solid var(--pb-grey);
}

.nmnwcpo-modal-header h3 {
    margin: 0 0 16px;
    font-size: 24px;
    line-height: 1.2;
}

.nmnwcpo-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: color .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.nmnwcpo-modal-close:hover {
    color: #000;
}

.nmnwcpo-modal h2 {
    font-size: 24px;
    line-height: 1.2;
}

.nmnwcpo-modal .product-sku {
    margin: 0 0 8px;
    font-size: 14px;
    color: #666;
}

.nmnwcpo-modal .product-price {
    font-size: 20px;
    font-weight: bold;
}

.nmnwcpo-modal .product-price-without-tax {
    margin: 0 0 16px;
    font-size: 14px;
    color: #666;
}

.nmnwcpo-modal .product-description {
    margin: 0 0 24px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}

.nmnwcpo-modal .product-description p {
    margin-bottom: 12px;
}

.nmnwcpo-modal .product-description p:last-child {
    margin-bottom: 0;
}

.nmnwcpo-modal .view-product {
    display: inline-block;
    padding: 12px 24px;
    background: var(--pb-default);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color .2s ease;
}

.nmnwcpo-modal .view-product:hover {
    background: #1aa558;
}

.nmnwcpo-modal .product-image-container {
    position: relative;
    margin-right: 32px;
    cursor: pointer;
}

.nmnwcpo-modal .product-image-container img {
    max-width: 300px;
    height: auto;
    display: block;
}

.nmnwcpo-modal .product-image-container:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.1);
}

.nmnwcpo-modal .product-image-container:hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3Cline x1='11' y1='8' x2='11' y2='14'%3E%3C/line%3E%3Cline x1='8' y1='11' x2='14' y2='11'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 5;
}

/* Lightbox styles */
.product-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.product-lightbox.active {
    display: flex;
}

.product-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.product-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
}

.product-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
}

/* Quote Form Modal Styles */
#quote-form-modal .nmnwcpo-modal-dialog {
    max-width: 600px;
}

#quote-form-modal .nmnwcpo-modal-body {
    padding: 20px;
}

.quote-form-content {
    width: 100%;
}

/* Form styling within the modal */
.quote-form-content form {
    width: 100%;
}

.quote-form-content input[type="text"],
.quote-form-content input[type="email"],
.quote-form-content input[type="tel"],
.quote-form-content textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--pb-grey);
    border-radius: 4px;
}

.quote-form-content textarea {
    min-height: 120px;
}

.quote-form-content input[type="submit"] {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--pb-default);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.quote-form-content input[type="submit"]:hover {
    background-color: #1aa558;
}
