.bacf {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;

    justify-content: center;
    align-items: center;
    overflow: hidden;

    --side-padding: 30px;
}

.bacf.active {
    display: flex;
}

.bacf__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(32, 32, 32, 0.5);
    backdrop-filter: blur(7px);
}

.bacf__modal-wrapper {
    position: relative;
    width: 100%;
    max-width: 1080px;
    margin: 1rem;
    background: #fff;
    border-radius: 10px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.bacf__content {
    position: relative;
    width: 100%;
    flex: 1;
    background: #fff;
    padding: 30px 0 16px;
    border-radius: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.bacf__title {
    padding: 0 var(--side-padding) 20px;
    font-weight: 600;
    font-size: 24px;
    line-height: 31px;
    border-bottom: 1px solid #EAE9E9;
}

.bacf__title span {
    font-size: 18px;
    color: #787676;
}

.bacf__step-section-title {
    font-weight: 600;
    font-size: 18px;
}

.bacf__step-section-title span {
    font-weight: 400;
    font-size: 16px;
}

.bacf__step-section-description {
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
    color: #787676;
}

.bacf__step-section-description p {
    margin: 0;
}

.bacf__close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    float: right;
}

.bacf__step {
    padding: 0 var(--side-padding);
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
    align-items: stretch;
}

.bacf__text-after-steps {
    flex-basis: 100%;
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
    color: #787676;
}

.bacf__columns-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bacf__confirmation {
    max-width: 740px;
    margin: auto;
}

.bacf__confirmation .bacf__title {
    text-align: center;
    border: 0;
}

.bacf__text {
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
    text-align: center;
}

.bacf__text.text-gray {
    color: #757575;
}

.bacf .bde-button__button {
    --bde-button-custom-border-color: var(--bde-headings-color);
    --bde-button-custom-border-color-hover: var(--bde-headings-color);
    --bde-button-custom-background-color: transparent;
    --bde-button-custom-background-color-hover: var(--bde-headings-color);
    --bde-button-custom-text-color: var(--bde-headings-color);
    --bde-button-custom-text-color-hover: #fff;
    border-radius: 9999px;
    --bde-button-width: max-content;
}

.bacf__prev,
.bacf__next,
.bacf__add-more,
.bacf__submit,
.bacf__return {
    /*display: none;*/
    max-width: max-content !important;
    gap: 8px;
}

.bacf__return {
    margin: auto !important;
}

.bacf__next {
    margin-left: auto !important;
}

.bacf__next img {
    transform: rotate(180deg);
}

.bacf__submit {
    float: right;
}

.bacf__submit img {
    height: 12px !important;
}

.bacf__prev::after,
.bacf__next::after,
.bacf__add-more::after,
.bacf__submit::after,
.bacf__return::after {
    content: none !important;
}

.bacf__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.bacf__item {
    border: 1px solid #EAE9E9;
    padding: 4px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    border-radius: 8px;
    background-color: #FAFAFA;
    position: relative;
    overflow: hidden;
    height: fit-content;
}

.bacf__item.hidden {
    display: none;
}

.bacf__item.selected {
    border-color: #202020;
}

.bacf__item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background-color: #202020;
    border-radius: 0 0 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url("images/checkmark.svg");
    background-size: 8px;
    background-repeat: no-repeat;
    background-position: center;
}

.bacf__item[data-disabled="true"] {
    pointer-events: none;
    opacity: 0.7;
}

.bacf__item-image {
    position: relative;
}

.bacf__item img {
    display: block;
    width: 100%;
    max-height: 120px;
    margin-bottom: 8px;
    object-fit: cover;
    transition: max-height 0.3s ease;
}

.bacf__profiles .bacf__grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.bacf__profiles .bacf__item {
    padding: 18px 16px 6px;
}

.bacf__profiles .bacf__item img {
	height: 50px;
    max-height: unset;
	object-fit: contain;
    margin-bottom: 0;
}

.bacf__profiles .bacf__item-id {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    line-height: 14px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    background-color: #C6C6C6;
    color: #000;
    border-radius: 0 0 4px 0;
    z-index: 1;
}

.bacf__item.selected .bacf__item-id {
    background-color: #202020;
    color: #fff;
}

.bacf__profiles .bacf__item.selected img {
    filter: brightness(0);
}

.bacf__item-title {
    text-align: center;
    font-size: 0.9rem;
}

.bacf__more {
    background: none;
    padding: 0;
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: #202020;
    font-size: 16px;
    line-height: 21px;
    font-weight: 500;
    margin: 24px auto 0;
    display: block;
}

.bacf__navigation {
    position: relative; /* Not absolute anymore */
    width: 100%;
    background-color: #fff;
    padding: 15px var(--side-padding);
    border-top: 1px solid #EAE9E9;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    border-radius: 0 0 10px 10px; /* Round bottom corners */
}

.bacf__selections {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bacf__selections:has(.bacf__selection-grid) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.bacf__selection {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 16px;
    border-bottom: 1px solid #EAE9E9;
}

.bacf__selection-card {
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.bacf__selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 15px;
    width: 100%;
}

.bacf__selection-image {
    margin: 8px 0;
    width: 100%;
    height: 80px;
    display: flex;
    overflow: hidden;
    border-radius: 4px;
}

.bacf__selection-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bacf__selection-card .bacf__selection-remove {
    position: absolute;
    top: 10px;
    right: 10px;
}

.bacf__selection-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
    line-height: 18px;
    min-width: 100px;
}

.bacf__selection-name {
    color: #787676;
}

.bacf__selection-remove {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
}

.bacf__selection-remove img {
    vertical-align: middle;
}

.bacf-sample .bacf__selections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.bacf-sample .bacf__selection {
    padding: 4px;
    border: 1px solid rgba(234, 233, 233);
    background: rgba(250, 250, 250, 1);
    max-height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    border-radius: 8px;
}

.bacf-sample .bacf__sample-image {
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    overflow: hidden;
    height: 100%;
}

.bacf-sample .bacf__selection img {
    display: block;
    object-fit: cover;
}

.bacf__details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bacf__product-details {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bacf__product-details.active {
    display: grid;
}

.bacf__field {
    position: relative;
}

.bacf__field input,
.bacf__field textarea,
.bacf__field select {
    border-radius: 4px;
    border: 1px solid #EAE9E9;
    transition: all 0.2s ease;
    line-height: 24px;
    font-size: 16px;
    padding: 12px 16px;
    width: 100%;
}

.bacf__field input {
    height: 50px;
}

.bacf__field input:focus-visible,
.bacf__field textarea:focus-visible,
.bacf__field select:focus-visible {
    border-color: #202020;
    outline: none;
}

.bacf__field input:focus::placeholder,
.bacf__field textarea:focus::placeholder {
    opacity: 0;
}

.bacf__field label {
    position: absolute;
    top: -5px;
    left: 12px;
    line-height: 10px;
    padding: 0 4px;
    background: #fff;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.bacf__field:has(input:focus) label,
.bacf__field:has(textarea:focus) label,
.bacf__field:has(select:focus) label,
.bacf__field:has(input:not(:placeholder-shown)) label,
.bacf__field:has(textarea:not(:placeholder-shown)) label,
.bacf__field:has(select:valid) label {
    opacity: 1;
}

.bacf__field-span-2 {
    grid-column: span 2;
}

.bacf__field select {
    appearance: none;
    position: relative;
}

.bacf__checkbox-field {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 15px !important;
    width: 100% !important;
}

/* Checkbox input styling */
.bacf__checkbox-field input[type="checkbox"] {
    width: auto !important;
    min-width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
}

/* Label styling */
.bacf__checkbox-field label {
    margin: 0 !important;
    padding: 0 !important;
    font-weight: normal !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    display: inline-block !important;
    flex: 1 !important;
    font-size: 16px;
    top: 0;
    left: 0;
}

.bacf__checkbox-field input[type="checkbox"]:checked {
    background-color: #202020 !important;
    border-color: #202020 !important;
    appearance: none !important;
    position: relative !important;
    padding: 0 !important;
}

.bacf__checkbox-field input[type="checkbox"]:checked::after {
    content: '' !important;
    position: absolute !important;
    left: 6px !important;
    top: 3px !important;
    width: 4px !important;
    height: 8px !important;
    border: solid white !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

.bacf__fastener-type-field {
    transition: all 0.3s ease;
    margin-top: 5px;
}

select + div.select-dropdown,
select ~ div.select-dropdown {
    position: absolute;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid #c6c6c6;
    background-color: white;
    width: 100%;
    overflow: hidden;
    z-index: 100;
}

.select-dropdown .option {
    font-size: 16px;
    height: 45px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
}

.select-dropdown .option:hover {
    background-color: #EAE9E9;
}

/* Steps */
.bacf__steps {
    display: flex;
    align-items: center;
    margin: 0 auto;
    padding: 0 var(--side-padding);
}

.step {
    display: flex;
    align-items: center;
    position: relative;
}

.step:not(:last-child) {
    flex: 1;
}

.step-number {
    --step-size: 20px;
    width: var(--step-size);
    height: var(--step-size);
    line-height: var(--step-size);
    border-radius: 50%;
    background-color: #000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    z-index: 2;
    transition: all 0.3s ease;
}

.step-name {
    margin-left: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
}

.step-line {
    --line-width: 50px;
    height: 1px;
    max-width: var(--line-width);
    min-width: var(--line-width);
    margin: 0 8px;
    z-index: 1;
    transition: all 0.3s ease;
    background-color: #000;
}

.step-number img.checkmark {
    display: none;
}

/* Inactive step styling */
.step.inactive .step-number {
    opacity: 0.5;
}

.step.inactive .step-name {
    opacity: 0.5;
}

.step-line.inactive {
    opacity: 0.5;
}

/* Active step styling */
.step.active .step-number,
.step.completed .step-number,
.step.active .step-name,
.step.completed .step-name,
.step.active .step-line,
.step.completed .step-line {
    opacity: 1;
}

.step.completed img.checkmark {
    display: block;
}

.step.completed .number {
    display: none;
}

@media (max-width: 600px) {
    .bacf__selection {
        gap: 16px;
    }

    .bacf__selection-cell {
        min-width: 50px;
    }

    .bacf__field {
        grid-column: span 2;
    }
}

@media (max-width: 500px) {
    .bacf {
        --side-padding: 20px;
    }

    .bacf__modal-wrapper {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
    }

    .bacf__content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        min-height: unset;
        margin: 0;
        border-radius: 0;
    }

    .bacf__title {
        font-size: 20px;
        line-height: 26px;
    }

    .bacf__title span {
        font-size: 16px;
    }

    .bacf__step-section-title {
        font-size: 16px;
    }

    .bacf__steps .step-line {
        --line-width: 25px;
    }

    .bacf__colors .bacf__item img {
        max-height: 110px;
    }

    .bacf__add-more {
        max-width: 100% !important;
    }
}

/* Enlarge icon styles */
.bacf__enlarge-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: #202020;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.bacf__enlarge-icon img {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    object-fit: contain !important;
}

.bacf__enlarge-icon.visible,
.bacf__colors .bacf__item:hover .bacf__enlarge-icon {
    opacity: 1;
}

/* For mobile devices, always show the enlarge icon */
@media (max-width: 768px) {
    .bacf__colors .bacf__item .bacf__enlarge-icon {
        opacity: 1;
    }
}

/* Enlarged image styles */
.bacf__enlarged-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 32, 32, 0.5);
    backdrop-filter: blur(7px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bacf__enlarged-image-container {
    position: relative;
    max-width: 800px;
    max-height: 500px;
    overflow: hidden;
    color: white;
    padding: 20px;
    border-radius: 10px;
}

.bacf__enlarged-image-container img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
    object-fit: cover;
}

.bacf__enlarged-image-title {
    text-align: center;
    margin-top: 16px;
    font-weight: 500;
    color: #fff;
}

.bacf__enlarged-image-close {
    position: absolute;
    top: 32px;
    right: 32px;
    width: 45px;
    height: 45px;
    background-color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}