/* Ad containers */
.ad-container {
    margin: 10px 0;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    display: none; /* Hide by default */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.ad-container.visible {
    display: block;
    opacity: 1;
}

#top-ad {
    width: 100%;
    margin: 0 auto 20px;
    text-align: center;
}

#left-ad {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 160px;
    background-color: #f8f8f8;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Sticky right flyer ad for category pages */
#right-ad {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 160px;
    background-color: #f8f8f8;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    max-height: 95vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#right-ad::-webkit-scrollbar {
    width: 6px;
}

#right-ad::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#right-ad::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#right-ad::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Category page layout adjustments */
/* Main content container for category pages */
body.category-page {
    position: relative;
    padding-right: 180px; /* Make space for the right flyer */
}

/* Album table adjustments */
table[width="991"] {
    width: 90% !important;
    max-width: 900px !important;
    margin: 0 auto 20px !important;
    float: none !important;
    clear: both !important;
}

/* Responsive adjustments */
@media screen and (max-width: 1399px) {
    #left-ad {
        display: none !important;
    }
    
    /* On smaller screens, make the right flyer smaller and adjust layout */
    #right-ad {
        width: 140px;
        padding: 8px;
    }
    
    body.category-page {
        padding-right: 160px;
    }
    
    table[width="991"] {
        width: 95% !important;
    }
}

/* Ad image styles */
.ad-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px;
    border: none;
    transition: transform 0.2s ease;
}

.ad-container img:hover {
    transform: scale(1.03);
}

/* Category page specific ad styles */
#category-ad {
    margin: 20px auto;
    max-width: 1200px;
    text-align: center;
}

#category-ad img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Clearfix for ad containers */
.ad-container::after {
    content: "";
    display: table;
    clear: both;
}

/* Ad labels */
.ad-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 1px;
}
