.msbel-buy-links {
    margin: 1em 0;
    padding: 0.8em;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.buy-links-header {
    margin-bottom: 0.8em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid #eee;
}

.buy-links-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.9em !important;
    font-weight: 600 !important;
    color: #333;
}

.buy-links-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 8px 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: scroll !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 !important;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    -ms-scroll-snap-type: x mandatory;
    scroll-snap-type: x mandatory;
}

/* Enable momentum scrolling on iOS */
@supports (-webkit-touch-callout: none) {
    .buy-links-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Hide scrollbar for Chrome, Safari and Opera */
.buy-links-container::-webkit-scrollbar {
    display: none;
}

.buy-link-wrapper {
    flex: 0 0 auto !important;
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 !important;
}

.buy-link-button {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 6px 10px !important;
    border-radius: 3px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border: none !important;
    overflow: hidden;
    min-height: 28px;
}

.buy-link-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none !important;
}

.buy-link-button:active {
    transform: translateY(0);
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    padding: 2px 0;
    position: relative;
}

.provider-logo {
    width: auto;
    height: 40px !important;
    max-height: 40px !important;
    object-fit: contain;
    margin: 0 !important;
    padding: 8px !important;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 6px;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    min-width: 80px; /* Ensure minimum width for better visibility */
}

/* Hide text and arrow when logo is present */
.has-logo .provider-name,
.has-logo .button-arrow {
    display: none !important;
}

/* Logo highlight effect */
.has-logo .provider-logo {
    padding: 6px !important;
    transition: all 0.3s ease;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.has-logo:hover .provider-logo {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Style for buttons without logo */
.provider-name {
    font-size: 11px !important;
    font-weight: 500 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.button-arrow {
    margin-left: 2px;
    font-size: 11px;
    opacity: 0.9;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Hover effects for text buttons */
.buy-link-button:not(.has-logo):hover .provider-name {
    text-decoration: underline;
}

.buy-link-button:not(.has-logo):hover .button-arrow {
    transform: translateX(2px);
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .buy-link-wrapper {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
    }
    
    .buy-links-container {
        padding: 10px 12px !important;
        scrollbar-width: none;
    }
    
    .buy-links-container::-webkit-scrollbar {
        display: none;
    }
    
    .buy-link-button {
        min-height: 100px;
        padding: 10px 8px !important;
    }
    
    .buy-link-button {
        width: 100%;
        min-height: 90px;
        height: 100%;
        padding: 10px 6px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border-radius: 6px !important;
        border: 1px solid rgba(0,0,0,0.05) !important;
        transition: all 0.2s ease;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .provider-logo {
        width: 100%;
        height: auto;
        max-height: 50px;
        min-height: 40px;
        padding: 6px !important;
        object-fit: contain;
        object-position: center;
        margin: 0 auto;
        display: block;
    }
    
    .provider-name {
        font-size: 11px !important;
        margin: 4px 0 0 !important;
        padding: 0 4px !important;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        box-sizing: border-box;
        color: #333;
    }
    
    .button-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
    }
    
    /* Adjust for smaller screens */
    @media (max-width: 380px) {
        .buy-links-container {
            gap: 6px;
            padding: 6px;
        }
        
        .buy-link-button {
            min-height: 85px;
            padding: 8px 4px !important;
        }
        
        .provider-logo {
            max-height: 45px;
            min-height: 35px;
            padding: 4px !important;
        }
        
        .provider-name {
            font-size: 10px !important;
            margin-top: 3px !important;
        }
    }
}

/* Button base styles */
.buy-link-button {
    min-height: 60px;
    padding: 12px 16px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease !important;
    border: none !important;
    border-radius: 8px !important;
    margin: 4px;
}

/* Remove background and shadow for logo buttons */
.buy-link-button.has-logo {
    background: transparent !important;
    box-shadow: none !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}

.ebook-notice {
    margin-top: 0.8em;
    padding: 6px 10px;
    background: #f8f9fa;
    border-left: 2px solid #4CAF50;
    border-radius: 2px;
}

.ebook-notice p {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    color: #555;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .msbel-buy-links {
        padding: 0.8em;
        margin: 0.8em 0;
    }

    .buy-links-container {
        grid-template-columns: 1fr;
    }

    .buy-link-button {
        padding: 6px 10px !important;
        min-height: 26px;
    }

    .provider-logo {
        height: 14px !important;
        max-height: 14px !important;
    }
}
