/* Dropdown Template Styles */

/* Lazy-load placeholder – reserves vertical space while AJAX content loads on mobile/tablet */
.fbt-lazy-placeholder {
    min-height: 40px;
}

/* AJAX loading spinner */
.fbt-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 2rem 0;
}

.fbt-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e5e5;
    border-top-color: var(--fbt-primary-color, #9b5b6c);
    border-radius: 50%;
    animation: fbt-spin 0.7s linear infinite;
}

@keyframes fbt-spin {
    to {
        transform: rotate(360deg);
    }
}

.fbt-dropdown-wrapper {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fafafa;
    clear: both;
}

.fbt-dropdown-title {
    text-align: left;
    font-size: 1.25rem;
    color: var(--fbt-secondary-color);
    font-weight: 400;
    margin-bottom: 1rem;
}

.fbt-dropdown-recommendations-container {
    margin-bottom: 1rem;
}

.fbt-dropdown-products {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    flex-wrap: wrap;
}

.fbt-dropdown-product {
    display: flex;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px;
    opacity: 1;
    transition: opacity 0.8s;
}

.fbt-dropdown-product-image {
    width: 140px;
    height: 140px;
    overflow: hidden;
    background-position: center center;
    background-size: contain;
    background-repeat: no-repeat;
    border-radius: 4px;
    flex-shrink: 0;
}

.fbt-dropdown-product-image-link {
    cursor: pointer;
    width: 140px;
    height: 140px;
    text-decoration: none;
    flex-shrink: 0;
}

.fbt-dropdown-plus-icon {
    user-select: none;
    font-size: 18px;
    font-weight: var(--fbt-font-weight);
    color: #000;
    text-shadow: rgba(255, 255, 255, 0.4) -1px 0px, rgba(255, 255, 255, 0.4) 0px 1px, rgba(255, 255, 255, 0.4) 1px 0px, rgba(255, 255, 255, 0.4) 0px -1px;
    text-align: center;
    transition: opacity 0.8s;
    margin: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
}

.fbt-dropdown-form {
    display: inline-block;
    margin-bottom: 12px;
    vertical-align: middle;
}

.fbt-dropdown-total-price-box {
    margin-bottom: 10px;
    margin-right: 0.5em;
}

.fbt-dropdown-total-price-text {
    color: var(--fbt-secondary-color);
    font-weight: 400;
    white-space: nowrap;
}

.fbt-dropdown-total-price-sale-price {
    margin-left: 0.25em;
    margin-right: 0.25em;
    font-weight: var(--fbt-font-weight);
}

.fbt-dropdown-container button.fbt-dropdown-add-button {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--fbt-primary-color);
    background-color: #fff;
    color: var(--fbt-primary-color);
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    font-weight: var(--fbt-font-weight);
    vertical-align: middle;
    display: inline-block;
    width: auto;
    margin-top: 0;
    margin-left: 0;
    cursor: pointer;
    transition: opacity 0.5s;
}

.fbt-dropdown-container button.fbt-dropdown-add-button:hover {
    background: var(--fbt-secondary-color);
    color: white;
    border-color: var(--fbt-secondary-color);
}

.fbt-dropdown-add-button.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.fbt-dropdown-selector-list {
    list-style: none;
    display: block;
    clear: left;
    padding-left: 0;
    margin-left: 0;
}

.fbt-dropdown-selector-list li {
    display: flex;
    list-style-type: none;
    opacity: 1;
    transition: opacity 0.5s;
    margin-bottom: 0.5rem;
    padding: 0;
    gap: 0.55rem;
}

.fbt-col.fbt-col-checkbox {
    display: flex;
    align-items: start;
    justify-content: center;
    min-width: 1.9rem;
    order: 1;
}

.fbt-col:not(.fbt-col-checkbox) {
    flex: 1;
}

/* Custom Checkbox Styles with SVG */
.fbt-dropdown-selector-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    margin: 0;
    cursor: pointer;
    border: 2px solid #ccc;
    border-radius: 4px;
    background-color: white;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fbt-dropdown-selector-input:checked {
    background-color: var(--fbt-primary-color);
    border-color: var(--fbt-primary-color);
}

.fbt-dropdown-selector-input:checked::before {
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.fbt-dropdown-selector-input:hover {
    border-color: var(--fbt-secondary-color);
    transform: scale(1.05);
}

.fbt-dropdown-selector-input:checked:hover {
    background-color: var(--fbt-secondary-color);
    border-color: var(--fbt-secondary-color);
    transform: scale(1.05);
}

.fbt-dropdown-selector-input:focus {
    outline: 2px solid var(--fbt-primary-color);
    outline-offset: 2px;
}


/* Unselected state styling */
.fbt-list-item-unselected .fbt-dropdown-selector-input {
    opacity: 0.6;
    border-color: #999;
}

.fbt-list-item-unselected .fbt-dropdown-selector-input:checked {
    opacity: 1;
}


/* Mobile responsive */
@media (max-width: 768px) {
    .fbt-dropdown-selector-input {
        width: 22px;
        height: 22px;
        min-width: 22px;
    }

    .fbt-dropdown-selector-input:checked::before {
        background-size: 14px 14px;
    }

    .fbt-col.fbt-col-checkbox {
        min-width: 26px;
        padding-top: 3px;
    }
}

.fbt-dropdown-selector-label-name {
    display: inline;
    color: var(--fbt-secondary-color);
    font-weight: 400;
    font-size: 0.9625em;
    line-height: 1.67em;
    margin-left: 5px;
}

.fbt-dropdown-this-item-label {
    font-weight: var(--fbt-font-weight);
}

.fbt-dropdown-selector-link {
    font-weight: 400;
    display: inline;
    color: var(--fbt-secondary-color);
    font-size: 0.9625em;
    text-decoration: none;
}

.fbt-dropdown-selector-link:hover {
    color: var(--fbt-primary-color);
}

.fbt-variant-select {
    display: inline-block;
    width: auto;
    max-width: 220px;
    font-size: 1em;
    font-weight: normal;
    border: 1px solid #ccc;
    color: #000;
    background-color: #fff;
    text-align: left;
    vertical-align: baseline;
    margin: 2px 2px 2px 5px;
    padding: 1px 25px 1px 10px;
    height: 2em;
    min-height: 2em;
    max-height: 2em;
    line-height: 1.1em;
    border-radius: 3px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-position: right center;
    background-image: var(--fbt-select-icon);
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* Focus visible */
.fbt-variant-select:focus-visible {
    outline: 1px solid var(--fbt-primary-color);
    outline-offset: 1px;
    border-color: transparent;
}

.fbt-dropdown-selector-label-sale-price {
    margin-left: 0.5em;
    white-space: nowrap;
    color: #333232;
    font-weight: var(--fbt-font-weight);
}

/* Savings Styles */
.fbt-dropdown-total-savings {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.9em;
    color: var(--fbt-primary-color);
    font-weight: 500;
}

.fbt-savings-text {
    color: rgba(var(--fbt-secondary-color-rgb), 0.7);
}

.fbt-savings-amount {
    color: var(--fbt-primary-color);
    font-weight: var(--fbt-font-weight);
}

/* Make it more prominent when there are actual savings */
.fbt-dropdown-total-savings:not([style*="display: none"]) {
    background: rgba(var(--fbt-primary-color-rgb), 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-right: 3px solid var(--fbt-primary-color);
}

.fbt-dropdown-cart-actions {
    padding-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    animation: fadeIn 0.3s ease-in;
}

.fbt-dropdown-cart-actions .button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.fbt-dropdown-cart-actions .fbt-go-cart:not(:hover) {
    background: transparent;
    border: 1px solid var(--fbt-primary-color);
    color: var(--fbt-primary-color);
}

.fbt-dropdown-cart-actions .fbt-go-cart:hover {
    background: var(--fbt-secondary-color);
    border: 1px solid var(--fbt-secondary-color);
    color: white;
}

.fbt-dropdown-cart-actions .fbt-go-checkout:not(:hover) {
    background: var(--fbt-primary-color);
    border: 1px solid var(--fbt-primary-color);
    color: white;
}

.fbt-dropdown-cart-actions .fbt-go-checkout:hover {
    background: var(--fbt-secondary-color);
    border: 1px solid var(--fbt-secondary-color);
}

/* Visual feedback for unselected items */
.fbt-product-unselected {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.fbt-product-unselected .fbt-dropdown-product-image {
    filter: grayscale(100%);
}

.fbt-list-item-unselected {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.fbt-list-item-unselected .fbt-dropdown-selector-label-name,
.fbt-list-item-unselected .fbt-dropdown-selector-link,
.fbt-list-item-unselected .fbt-dropdown-selector-label-sale-price {
    color: #999 !important;
}

/* Disabled button styles */
.fbt-dropdown-add-button.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    background: #f5f5f5 !important;
    color: #999 !important;
    border-color: #ddd !important;
}

.fbt-dropdown-add-button.disabled:hover {
    background: #f5f5f5 !important;
    color: #999 !important;
    border-color: #ddd !important;
}

/* Main product always selected style */
.fbt-dropdown-product:first-child .fbt-dropdown-selector-input {
    cursor: not-allowed;
}

.fbt-gallery-placeholder {
    display: inline-flex;
}


@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width:440px) {

    .fbt-dropdown-wrapper,
    .fbt-dropdown-selector-list {
        padding-left: 0.70rem;
        padding-right: 0.70rem;
    }

}

/* Responsive Design */
@media (max-width: 768px) {
    .fbt-dropdown-products {
        justify-content: left;
    }

    .fbt-dropdown-product-image,
    .fbt-dropdown-product-image-link {
        width: 100px;
        height: 100px;
    }

    .fbt-dropdown-plus-icon {
        height: 100px;
        line-height: 100px;
    }

    .fbt-dropdown-form {
        display: block;
    }

    .fbt-variant-select {
        max-width: 150px;
    }
}