/**
 * Frequently Bought Together (FBT) Styles
 */

.mircato-pro .mircato-fbt-wrapper {
    margin-top: var(--space-2xl);
    padding: var(--space-xl);
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    clear: both;
    display: block;
    box-sizing: border-box;
    float: none;
    width: 100%;
    max-width: 100%;
}

.mircato-fbt-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-xl);
    margin-top: 0;
    color: var(--color-heading);
    text-align: left;
}

/* Images Row */
.mircato-fbt-images {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: nowrap;
    /* Prevent stacking */
    overflow-x: auto;
    /* Scroll if too many */
    padding-bottom: var(--space-sm);
}

.fbt-image-item {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: opacity var(--transition-base);
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.fbt-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fbt-plus-sign {
    font-size: var(--text-2xl);
    font-weight: 400;
    color: var(--color-gray-400);
    flex-shrink: 0;
}

/* Items List */
.mircato-fbt-items {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-xl) 0;
    text-align: left;
    width: 100%;
    display: block;
}

.fbt-item {
    margin-bottom: var(--space-lg);
    /* increased spacing */
    transition: opacity var(--transition-base);
}

.fbt-item.is-inactive {
    opacity: 0.5;
}

.fbt-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--text-base);
    /* bumped up from sm */
    color: var(--color-body);
    width: 100%;
}

.mircato-pro .mircato-fbt-checkbox {
    margin-right: var(--space-md);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.fbt-item-name {
    flex-grow: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1.4;
}

.fbt-item-name strong {
    color: var(--color-primary);
    margin-right: 6px;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.fbt-item-name a {
    color: var(--color-body);
    text-decoration: none;
}

.fbt-item-price {
    font-weight: 600;
    color: var(--color-heading);
    margin-left: auto;
    /* Push to right */
    padding-left: var(--space-md);
    min-width: 80px;
    text-align: right;
}

/* Actions Row */
.mircato-fbt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
    gap: var(--space-xl);
    width: 100%;
    clear: both;
}

.fbt-total-price-wrap {
    display: flex;
    flex-direction: column;
}

.fbt-total-label {
    font-size: var(--text-xs);
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.fbt-total-price {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-heading);
    line-height: 1;
}

/* Add to Cart Button tweaks */
.mircato-pro .mircato-fbt-add-to-cart {
    margin: 0;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-sm);
    height: auto;
    line-height: 1.5;
}

.mircato-fbt-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Variation Selectors */
.fbt-variation-selectors {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 10px 0 15px 32px; /* Indent to align with product name after checkbox */
    width: auto;
}

/* Force horizontal layout for swatches inside FBT */
.mircato-fbt-wrapper .fbt-variation-selectors .mircato-swatches {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* Resize swatches to be slightly smaller in FBT list */
.mircato-fbt-wrapper .fbt-variation-selectors .mircato-swatch-item {
    padding: 4px 10px;
    font-size: 11px;
    min-width: 30px;
}

.mircato-fbt-wrapper .fbt-variation-selectors .mircato-swatch-item.swatch-color,
.mircato-fbt-wrapper .fbt-variation-selectors .mircato-swatch-item.swatch-image {
    width: 28px;
    height: 28px;
}

/* Standard dropdown fallback */
.fbt-variation-select {
    width: 100%;
    max-width: 200px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    background-color: var(--color-white);
    color: var(--color-body);
    outline: none;
    transition: border-color var(--transition-base);
}

.fbt-variation-select:focus {
    border-color: var(--color-primary);
}

/* FBT Actions & Message */
.fbt-button-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.mircato-fbt-message {
    font-size: var(--text-sm);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: none; /* Hidden by default */
    animation: fadeIn var(--transition-base);
    max-width: 400px;
    text-align: right;
}

.mircato-fbt-message.error {
    display: block;
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.mircato-fbt-message.success {
    display: block;
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 575px) {
    .fbt-button-wrap {
        align-items: stretch;
    }
    
    .mircato-fbt-message {
        text-align: center;
        max-width: 100%;
    }

    .mircato-fbt-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }

    .mircato-fbt-add-to-cart {
        width: 100%;
    }

    .fbt-total-price-wrap {
        align-items: center;
        text-align: center;
    }
}