/* Advertisement Sidebar Styles */
.ad-sidebar {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.ad-sidebar:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Position-specific styles */
.ad-sidebar-left {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
}

.ad-sidebar-right {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
}

.ad-sidebar-top {
    position: relative;
    margin: 0 auto;
    display: block;
}

.ad-sidebar-bottom {
    position: relative;
    margin: 0 auto;
    display: block;
}

/* Ad slot styles */
.ad-slot {
    transition: background-color 0.2s ease;
}

/* Vertical layout styles (default) */
.ad-sidebar:not(.flex) .ad-slot,
.ad-sidebar.block .ad-slot {
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 1rem;
    display: block;
    width: 100%;
}

.ad-sidebar:not(.flex) .ad-slot:last-child,
.ad-sidebar.block .ad-slot:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Horizontal layout styles */
.ad-sidebar.flex {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ad-sidebar.flex .ad-slot {
    border-right: 1px solid #f0f0f0;
    padding-right: 0.5rem;
    margin-right: 0.5rem;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    display: block;
}

.ad-sidebar.flex .ad-slot:last-child {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
}

.ad-slot:hover {
    background-color: #f9f9f9;
}

.ad-image img {
    transition: transform 0.2s ease;
}

.ad-image:hover img {
    transform: scale(1.02);
}

.ad-title a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.ad-placeholder {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ad-placeholder:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* Empty slot specific styles */
.ad-slot-empty .ad-placeholder {
    min-height: 80px;
    opacity: 0.7;
}

.ad-slot-empty:hover .ad-placeholder {
    opacity: 1;
    transform: scale(1.02);
}

/* Direct link ad styles */
.direct-link-ad {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.direct-link-ad iframe {
    border: none;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.direct-link-ad:hover iframe {
    transform: scale(1.02);
}

/* Mobile visibility control */
.ad-sidebar.mobile-hidden {
    display: block; /* Show on desktop by default */
}

.ad-sidebar.mobile-visible {
    display: block; /* Show on all devices */
}

/* Sidebar position behavior control */
.sidebar-fixed.ad-sidebar-left,
.sidebar-fixed.ad-sidebar-right {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 35; /* Below header (z-index: 40) but above content */
}

.sidebar-static.ad-sidebar-left,
.sidebar-static.ad-sidebar-right {
    position: absolute;
    top: auto;
    transform: none;
    z-index: 30;
}

/* Ensure top and bottom sidebars are always static */
.ad-sidebar-top,
.ad-sidebar-bottom {
    position: relative !important;
    top: auto !important;
    transform: none !important;
}

/* Responsive design */
@media (max-width: 1200px) {
    .ad-sidebar-left,
    .ad-sidebar-right {
        display: none;
    }
    
    /* Override for mobile-visible sidebars */
    .ad-sidebar-left.mobile-visible,
    .ad-sidebar-right.mobile-visible {
        display: block;
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
        margin: 10px auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    /* Hide sidebars on mobile unless specifically enabled */
    .ad-sidebar.mobile-hidden {
        display: none !important;
    }
    
    .ad-sidebar.mobile-visible {
        display: block !important;
    }
    
    .ad-sidebar-top.mobile-visible,
    .ad-sidebar-bottom.mobile-visible {
        width: 100% !important;
        max-width: 100%;
        margin: 10px auto;
    }
    
    .ad-sidebar-left.mobile-visible,
    .ad-sidebar-right.mobile-visible {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
        width: 100% !important;
        max-width: 100%;
        margin: 10px auto;
    }
    
    .ad-sidebar.mobile-visible {
        margin: 10px;
        padding: 10px;
    }
}

/* Animation for sidebar appearance */
.ad-sidebar {
    animation: slideIn 0.5s ease-out;
}

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

.ad-sidebar-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%) translateY(-50%);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(-50%);
    }
}

.ad-sidebar-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(-50%);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(-50%);
    }
}
