/**
 * AdLogic Frontend Placement Styles
 * File: /assets/css/frontend/placements.css
 */

/* CRITICAL: Remove horizontal margins/padding from inner ad containers to prevent creative cropping */
/* NOTE: .adlogic-content-placement wrapper is EXCLUDED - it needs margin:auto to center in WordPress block themes */
/* Centering of inner elements is achieved via text-align: center on wrapper */
.adlogic-block,
.adlogic-block > *,
.adlogic-content-placement > *,
.adlogic-block-display,
.adlogic-block-display > *,
div[id^="div-gpt-ad-"],
.adlogic-display-container,
.adlogic-placement-wrapper,
.adlogic-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

/* Wrapper needs margin:auto for centering in WordPress block themes (is-layout-constrained) */
.adlogic-content-placement,
.adlogic-content-placement .video-wrapper-container {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Ad Block Container */
.adlogic-block {
    margin: 0;
    position: relative;
    clear: both;
    text-align: center; /* Center child elements without using margins */
}

/* Standard Ad Slots */
.adlogic-ad-slot {
    background: #f9f9f9;
    border: 2px dashed #ddd;
    text-align: center;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.adlogic-ad-slot p {
    margin: 0;
    color: #666;
}

.adlogic-ad-slot p:last-child {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Debug Mode Info */
.adlogic-debug-block-info {
    background: #3b82f6;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    font-family: monospace;
    position: absolute;
    top: -25px;
    left: 0;
    border-radius: 4px;
    z-index: 10;
    white-space: nowrap;
}

/* Different Ad Types */
.adlogic-block-banner {
    max-width: 728px;
    /* REMOVED: margin-left: auto; margin-right: auto; */
    /* Centering is handled by text-align: center on parent to avoid reducing creative space */
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    display: inline-block; /* Allows text-align: center to work */
}

.adlogic-block-sidebar {
    max-width: 300px;
}

.adlogic-block-interstitial {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: white;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    display: none;
}

.adlogic-block-sticky {
    position: sticky;
    bottom: 20px;
    z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .adlogic-block-banner {
        max-width: 100%;
    }
    
    .adlogic-ad-slot {
        min-height: 200px;
    }
}

/* Loading state */
.adlogic-block.loading .adlogic-ad-slot {
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.adlogic-block.loading .adlogic-ad-slot::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: adlogic-loading 1.5s infinite;
}

@keyframes adlogic-loading {
    to {
        left: 100%;
    }
}

/* GPT Ad Container */
.adlogic-gpt-ad {
    min-height: 50px;
    text-align: center;
    /* Ensure no horizontal margins/padding that reduce creative space */
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    display: inline-block; /* Allows parent text-align: center to work */
    max-width: 100%; /* Prevent overflow */
}

/* Visibility classes */
.adlogic-block.hidden {
    display: none;
}

.adlogic-block.visible {
    display: block;
}

/* Lazy loading */
.adlogic-block[data-lazy="true"] {
    min-height: 250px;
    background: #f9fafb;
}

.adlogic-block[data-lazy="true"].loaded {
    min-height: auto;
    background: transparent;
}