/* Amazon Product Ads - Premium Modern UI */

/* Hide container by default until products load */
.amazon-ads-container {
    display: none;
    margin: 3rem auto;
    max-width: 1300px;
    padding: 0 1rem;
}

.amazon-ads-container.loaded {
    display: block;
    animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Ad Label - Required by advertising standards */
.amazon-ad-label {
    text-align: center;
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Ad Unit Container - Glassmorphism style */
.amazon-ad-unit {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.9), rgba(20, 20, 30, 0.95));
    border: 1px solid rgba(255, 153, 0, 0.15);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Ad Header */
.amazon-ads-header {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 153, 0, 0.1);
}

.amazon-ads-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, #fff, #FF9900);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.amazon-ads-subtitle {
    color: #888;
    font-size: 0.85rem;
    font-weight: 400;
}

/* Products Grid - Premium Layout */
/* Enforcing 6 columns for Desktop and 3 for Mobile as requested */
.amazon-products-grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important; /* Force 6 columns on desktop */
    gap: 1.25rem;
    justify-content: center; /* Center items if they don't fill the row */
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* Optional: 4 columns for smaller desktops/tablets to prevent squeezing */
    .amazon-products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .amazon-products-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* Force 3 columns on mobile */
        gap: 0.5rem; /* Reduce gap for mobile */
    }

    .amazon-ad-unit {
        padding: 1rem;
        border-radius: 12px;
    }

    .amazon-product-title {
        font-size: 0.7rem; 
        min-height: 2.5em;
    }

    .amazon-product-price {
        font-size: 0.9rem;
    }
    
    .amazon-ads-title {
        font-size: 1.15rem;
    }
}

@media (max-width: 480px) {
    /* For very small screens, 3 might be too tight, but keeping 3 as per strict request. 
       If needed, we can switch to 2 here, but sticking to the user's "3 mobile" rule.
       However, 3 columns on a 320px screen is very tight. 
       I will keep it 3 but reduce padding/font sizes further if needed.
       Actually, standard mobile UI usually does 2. 
       But user said "3 mobile". I will respect that. */
       
    .amazon-products-grid {
        gap: 0.25rem;
    }
    
    .amazon-product-info {
        padding: 0.5rem;
    }
    
    .amazon-buy-button {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
}

/* Loading Animation */
.amazon-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #888;
    font-size: 0.9rem;
}

.amazon-loading i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #FF9900;
    display: block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

/* Product Card - Premium Design */
.amazon-product-card {
    background: linear-gradient(145deg, rgba(40, 40, 50, 0.9), rgba(25, 25, 35, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.amazon-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FF9900, #FFD814, #FF9900);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.amazon-product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(255, 153, 0, 0.2),
                0 0 30px rgba(255, 153, 0, 0.1);
    border-color: rgba(255, 153, 0, 0.3);
}

.amazon-product-card:hover::before {
    opacity: 1;
}

/* Product Image Container */
.amazon-product-image-container {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.amazon-product-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(0,0,0,0.05), transparent);
    pointer-events: none;
}

.amazon-product-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transition: transform 0.4s ease;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
}

.amazon-product-card:hover .amazon-product-image {
    transform: scale(1.08);
}

/* Product Info */
.amazon-product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(30, 30, 40, 0) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.amazon-product-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.65rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    min-height: 2.7em;
    flex: 1;
}

/* Rating - Premium Style */
.amazon-product-rating {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    font-size: 0.8rem;
}

.amazon-stars {
    color: #FFD814;
    font-size: 0.85rem;
    text-shadow: 0 0 8px rgba(255, 216, 20, 0.4);
    display: flex;
    align-items: center;
}

.amazon-stars i {
    margin-right: 2px;
}

.amazon-review-count {
    color: #999;
    font-size: 0.72rem;
}

/* Price - Prominent Display */
.amazon-product-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: #FF9900;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 8px rgba(255, 153, 0, 0.2);
}

/* Buy Button - Amazon Premium Style */
.amazon-buy-button {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: linear-gradient(180deg, #FFD814 0%, #F7CA00 50%, #EAB800 100%);
    color: #0F1111;
    text-align: center;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.25s ease;
    font-size: 0.82rem;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 216, 20, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.amazon-buy-button:hover {
    background: linear-gradient(180deg, #FFE45C 0%, #FFD814 50%, #F7CA00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 216, 20, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    color: #0F1111;
    text-decoration: none;
}

/* Top Rated Badge */
.amazon-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #FF9900, #FF6600);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Amazon Attribution */
.amazon-attribution {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 153, 0, 0.1);
    font-size: 0.72rem;
    color: #666;
}

.amazon-attribution a {
    color: #FF9900;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.amazon-attribution a:hover {
    color: #FFD814;
    text-decoration: none;
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .amazon-product-image-container {
        background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    }
}
