/* Frequently Bought Together Styles */
.ess-fbt-wrapper {
    margin: 30px 0;
    padding: 0;
    border: none;
    background-color: transparent;
    box-shadow: none;
    font-family: inherit; /* Respect theme font */
}

.ess-fbt-wrapper h2 {
    font-size: 1.25rem;
    margin-bottom: 25px;
    color: #333;
    font-weight: 600;
}

.ess-fbt-items-container {
    display: flex;
    align-items: center; /* Center align items and plus signs vertically */
    flex-wrap: nowrap; /* FORCE items to stay on a single line */
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto; /* Add back scroll if it really overflows */
    padding-bottom: 10px;
    scrollbar-width: thin;
    width: 100%;
}

/* Restored custom scrollbar */
.ess-fbt-items-container::-webkit-scrollbar {
    height: 6px;
    display: block; /* Make sure it shows if needed */
}
.ess-fbt-items-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.ess-fbt-items-container::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 4px;
}
.ess-fbt-items-container::-webkit-scrollbar-thumb:hover {
    background: #aaa; 
}

.ess-fbt-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0; /* Override any min-width that forces overflow */
    width: 30%; /* Take about a third of the container */
    max-width: 150px;
    flex: 1 1 0; /* Allow equal shrinking and growing */
    background: #fff;
    padding: 10px 5px; /* Reduce padding slightly */
    border-radius: 10px;
    border: 1px solid #eaeaea; /* Restored border */
    position: relative;
    transition: all 0.3s ease;
}

.ess-fbt-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Restored hover shadow */
    border-color: #d0d0d0;
}

.ess-fbt-item.ess-fbt-item-unchecked {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.ess-fbt-item-image {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1; /* Push info to bottom */
}

.ess-fbt-item-image img {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}

.ess-fbt-checkbox {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 10;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff007b; /* Try to match the pink theme color */
}

.ess-fbt-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ess-fbt-item-title {
    font-size: 0.75rem; /* Make text smaller so it fits */
    color: #444;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 500;
    margin: 0;
}

.ess-fbt-item-title:hover {
    color: #ff007b; /* Match theme color */
}

.ess-fbt-item-price {
    font-weight: 600;
    color: #ff007b; /* Match theme color */
    font-size: 0.9rem; /* Make price smaller */
}

.ess-fbt-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem; /* Smaller plus sign */
    color: #999;
    font-weight: 300;
    padding: 0 2px; /* Less padding around plus */
    flex-shrink: 0;
}

.ess-fbt-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    flex-wrap: wrap;
    gap: 15px;
}

.ess-fbt-total-price-wrapper {
    font-size: 1rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ess-fbt-total-price {
    font-weight: 700;
    font-size: 1.3rem;
    color: #ff007b; /* Match theme color */
}

.ess-fbt-add-to-cart {
    background-color: #000000 !important; /* Black button */
    border-color: #000000 !important;
    color: #ffffff !important;
    border-radius: 25px !important;
    padding: 12px 25px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    text-transform: none !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}

.ess-fbt-add-to-cart:hover {
    background-color: #333333 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3) !important;
}

/* Fallback Banner */
.ess-fbt-fallback-banner {
    margin: 30px 0;
    text-align: center;
}

.ess-fbt-fallback-banner img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
    width: 100%;
}

.ess-fbt-fallback-banner img:hover {
    transform: scale(1.02);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .ess-fbt-summary {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .ess-fbt-add-to-cart {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ess-fbt-item {
        min-width: 110px;
        padding: 10px;
    }
    
    .ess-fbt-item-title {
        font-size: 0.75rem;
    }
    
    .ess-fbt-item-price {
        font-size: 0.9rem;
    }
    
    .ess-fbt-wrapper h2 {
        font-size: 1.1rem;
        text-align: center;
    }
}

/* Modal Styles */
.ess-fbt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ess-fbt-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.ess-fbt-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

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

.ess-fbt-modal-product-variations {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.ess-fbt-modal-product-variations h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.ess-fbt-error {
    border: 1px solid red;
    padding: 10px;
    background-color: #fff0f0;
}
