/* Affiliate Product Display Styles - Versione Precedente Migliorata */
.affiliate-product {
    margin: 15px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    text-align: center;
}

.affiliate-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.affiliate-product-inner {
    text-align: center;
}

/* CONTENITORE IMMAGINE QUADRATO - COME PRIMA */
.affiliate-product-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Crea un quadrato */
    overflow: hidden;
    border-radius: 8px;
    background: #f8f8f8;
    margin-bottom: 12px;
}

.affiliate-product-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 80%;
    max-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.affiliate-product-title {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
}

.affiliate-product-title a {
    text-decoration: none;
    color: #333;
}

.affiliate-product-title a:hover {
    color: #e47911;
}

.affiliate-product-price {
    font-size: 16px;
    font-weight: bold;
    color: #B12704;
    margin: 8px 0;
}

.affiliate-product-button {
    margin-top: 10px;
}

.affiliate-button {
    display: inline-block;
    background: #FFA41C;
    color: #000 !important;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
    font-size: 13px;
    border: 1px solid #FF8F00;
    transition: all 0.3s ease;
}

.affiliate-button:hover {
    background: #FA8900;
    transform: scale(1.05);
}

/* Vendor-specific button colors */
.affiliate-product-amazon .affiliate-button {
    background: #FFA41C;
    color: #000 !important;
}

.affiliate-product-ebay .affiliate-button {
    background: #0064D2;
    color: white !important;
}

.affiliate-product-aliexpress .affiliate-button {
    background: #FF6A00;
    color: white !important;
}

.affiliate-product-zalando .affiliate-button {
    background: #FF3366;
    color: white !important;
}

.affiliate-product-other .affiliate-button {
    background: #667eea;
    color: white !important;
}

/* Allineamenti */
.affiliate-product-left {
    float: left;
    margin-right: 20px;
}

.affiliate-product-right {
    float: right;
    margin-left: 20px;
}

.affiliate-product-center {
    margin-left: auto;
    margin-right: auto;
    float: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .affiliate-product {
        float: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .affiliate-product-image {
        padding-bottom: 100%; /* Mantiene il quadrato anche su mobile */
    }
}

/* Mobile-only display */
.amazon-mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    .amazon-mobile-only {
        display: block;
    }
}

/* Loading state per tracking */
.apd-track-click {
    position: relative;
}

.apd-track-click.loading {
    pointer-events: none;
    opacity: 0.7;
}

.apd-track-click.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}