/* Main Offers Grid */
.spb-offers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: flex-start;
}

.spb-offer-widget {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    flex: 1 1 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

.spb-offer-widget:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Main Horizontal Container */
.spb-container {
    display: flex;
    flex-direction: row; /* Horizontal layout for the main container */
    align-items: center; /* Vertically align items */
    gap: 15px; /* Spacing between elements */
    border: 2px dashed #a78bfa;
    border-radius: 12px;
    padding: 15px;
    background-color: #f5f3ff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
    height: 100%;
}

.spb-container:hover {
    border-style: solid;
    border-color: #8b5cf6;
}

/* Auto-added Success Message */
.spb-auto-added-notice {
    border-style: solid;
    border-color: #4ade80;
    background-color: #f0fdf4;
}

.spb-auto-added-notice p {
    margin: 0;
    color: #166534;
    font-size: 0.9em;
    text-align: center;
    padding: 10px;
    flex: 1; /* Allow content to grow */
}

/* Images Section */
.spb-images {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 0; /* No bottom margin for horizontal layout */
    flex-shrink: 0; /* Prevent images from shrinking */
}

.spb-image-item {
    position: relative;
    flex-shrink: 0;
}

.spb-image-item img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.spb-qty-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #8b5cf6;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 1.5px solid #fff;
}

/* Content Section */
.spb-content {
    text-align: left; /* Left align for horizontal layout */
    margin-bottom: 0;
    flex-grow: 1; /* Allow content to take up available space */
}

.spb-title {
    margin: 0 0 8px 0;
    font-size: 1em;
    color: #4c1d95;
    font-weight: 600;
    line-height: 1.3;
}

.spb-pricing {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Left align prices */
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.spb-final-price {
    font-size: 1.3em;
    font-weight: bold;
    color: #4c1d95;
}

.spb-original-price s {
    font-size: 0.9em;
    color: #6b7280;
}

.spb-savings {
    background-color: #fde047;
    color: #713f12;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

/* Action Section */
.spb-action {
    text-align: right; /* Right align button */
    margin-top: 0;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.spb-add-to-cart-btn {
    padding: 10px 16px !important;
    border-radius: 8px !important;
    background: linear-gradient(45deg, #8b5cf6, #6366f1) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-size: 0.9em !important;
    width: auto; /* Auto width for horizontal layout */
    white-space: nowrap;
}

.spb-add-to-cart-btn:hover {
    background: linear-gradient(45deg, #6366f1, #8b5cf6) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.spb-add-to-cart-btn.loading {
    cursor: wait !important;
    background: #9ca3af !important;
}

.spb-message {
    margin-top: 8px;
    font-size: 0.8em;
    font-weight: 500;
    display: none;
}

/* Gift Offers */
.spb-gift-offer {
    border: 2px dashed #fbbf24;
    border-radius: 12px;
    padding: 15px;
    background-color: #fffbeb;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.spb-gift-offer h4 {
    margin: 0 0 8px 0;
    font-size: 1em;
    color: #92400e;
    font-weight: 600;
}

.spb-gift-offer > p {
    margin: 0 0 12px 0;
    font-size: 0.9em;
    color: #78350f;
}

.spb-gift-products {
    display: flex;
    flex-direction: column; /* Arrange choices vertically */
    gap: 10px; /* Space between each choice */
    justify-content: center;
}

.spb-gift-product {
    display: flex; /* Use flexbox for horizontal layout */
    flex-direction: row; /* Align items in a row */
    align-items: center; /* Vertically center items */
    text-align: left;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    transition: all 0.3s ease;
    width: 100%; /* Take full width */
}

.spb-gift-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(251, 191, 36, 0.2);
    border-color: #f59e0b;
}

.spb-gift-product img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}

.spb-gift-product h5 {
    margin: 0; /* We now use .spb-gift-product-title */
}
.spb-gift-product-image {
    flex-shrink: 0; /* Prevent image from shrinking */
    margin-right: 12px;
}

.spb-gift-product-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0; /* Remove bottom margin */
    display: block;
}
.spb-gift-product-details {
    flex-grow: 1; /* Allow details to take up available space */
}
.spb-gift-product-title {
    margin: 0;
    font-size: 0.9em;
    color: #78350f;
    line-height: 1.3;
    font-weight: 600;
}
.spb-gift-product-action {
    flex-shrink: 0; /* Prevent button from shrinking */
    margin-left: 12px;
}
.spb-add-gift-btn {
    background: linear-gradient(45deg, #f59e0b, #d97706) !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    font-size: 0.85em !important;
    font-weight: 500 !important;
    white-space: nowrap; /* Prevent text wrapping */
}
.spb-add-gift-btn:hover {
    background: linear-gradient(45deg, #d97706, #b45309) !important;
}
/* Discount Offers */
.spb-discount-offer {
    border: 2px dashed #10b981;
    border-radius: 12px;
    padding: 15px;
    background-color: #ecfdf5;
    text-align: center;
    display: flex;
    flex-direction: row; /* Horizontal layout for discount */
    align-items: center;
    gap: 15px;
}

.spb-discount-offer h4 {
    margin: 0 0 8px 0;
    font-size: 1em;
    color: #065f46;
    font-weight: 600;
}

.spb-discount-offer > p {
    margin: 0 0 12px 0;
    font-size: 0.9em;
    color: #047857;
}

.spb-apply-discount-btn {
    background: linear-gradient(45deg, #10b981, #059669) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9em !important;
    width: auto;
    white-space: nowrap;
}

.spb-apply-discount-btn:hover {
    background: linear-gradient(45deg, #059669, #047857) !important;
    transform: translateY(-1px);
}


/* Responsive Design */
@media (max-width: 768px) {
    .spb-offers-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .spb-offer-widget {
        flex: 1 1 100%;
        min-width: unset;
        width: 100%;
    }
    
    .spb-container,
    .spb-gift-offer,
    .spb-discount-offer {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    
    .spb-container .spb-content {
        text-align: center;
    }

    .spb-container .spb-pricing {
        justify-content: center;
    }
    
    .spb-add-to-cart-btn {
        width: 100%;
    }
    
    .spb-apply-discount-btn {
        width: 100%;
    }

    .spb-gift-products {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

/* Loading states */
.spb-offer-widget[data-loading="true"] {
    opacity: 0.7;
    pointer-events: none;
}
/* Styles for multi-choice gifts */
.spb-gift-product.chosen {
    border-color: #f59e0b;
    background-color: #fff7ed;
}

.spb-gift-product.limit-reached {
    opacity: 0.6;
    background-color: #f9fafb;
}

.spb-add-gift-btn:disabled {
    cursor: not-allowed !important;
    background: #9ca3af !important;
}

.spb-gift-product.chosen .spb-add-gift-btn:disabled {
     background: linear-gradient(45deg, #10b981, #059669) !important; /* Green for selected */
}