/* Ad Container Styles */
.ad-container {
    margin: 2rem auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    max-width: 100%;
    width: 100%; /* Ensure it takes full available width */
    min-width: 250px; /* Force a minimum width for AdSense */
    overflow: hidden;
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Header Ad - Only on non-memorial pages */
.header-ad {
    margin-top: 1rem;
    margin-bottom: 2rem;
    min-height: 90px; /* Standard ad height */
}

/* Sidebar Ad - Only on non-memorial pages */
.sidebar-ad {
    margin: 2rem 0;
    min-height: 600px; /* Standard sidebar ad height */
}

/* Footer Ad - Only on non-memorial pages */
.footer-ad {
    margin-top: 3rem;
    margin-bottom: 1rem;
    min-height: 90px; /* Standard ad height */
}

/* Between Listings Ad - Only on homepage */
.between-listings-ad {
    margin: 3rem auto;
    min-height: 250px; /* Standard rectangle ad height */
}

/* Responsive Design */
@media (max-width: 768px) {
    .ad-container {
        margin: 1.5rem auto;
    }
    
    .sidebar-ad {
        min-height: 250px; /* Smaller height on mobile */
    }
    
    .between-listings-ad {
        min-height: 100px; /* Smaller height on mobile */
    }
}

/* Hide ads on memorial pages */
.memorial-page .ad-container,
.view-memorial .ad-container,
.memorial-content .ad-container {
    display: none !important;
}

/* Ad Label */
.ad-label {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    margin-bottom: 0.5rem;
    font-family: 'Lato', sans-serif;
}

/* AdSense Responsive Container */
.adsense-responsive {
    display: block;
    text-align: center;
    overflow: hidden;
    position: relative;
    min-height: 90px;
}

.adsense-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Loading State */
.ad-container.loading {
    background: rgba(255, 255, 255, 0.02);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.8; }
    100% { opacity: 0.6; }
} 