/* ===================================
   ADVERTISEMENT CONTAINERS
   Modern styling for ad placements
   =================================== */

:root {
    --ad-border-color: rgba(102, 126, 234, 0.15);
    --ad-bg-color: rgba(248, 249, 250, 0.8);
    --ad-label-color: #6c757d;
    --ad-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* ===================================
   HEADER BANNER AD
   =================================== */

.ad-container-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--ad-border-color);
    padding: 1rem 0;
    margin-bottom: 0;
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.ad-container-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--ad-border-color) 50%, transparent 100%);
}

/* Advertisement label */
.ad-label {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--ad-label-color);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ad-label i {
    font-size: 0.6rem;
}

/* ===================================
   SIDEBAR AD BLOCKS
   =================================== */

.ad-sidebar-container {
    position: sticky;
    top: 100px;
    z-index: 100;
}

.ad-container-sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid var(--ad-border-color);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--ad-shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-container-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.ad-container-sidebar:hover::before {
    opacity: 1;
}

.ad-container-sidebar:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.25);
}

.ad-container-sidebar .ad-label {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-bottom: 1rem;
}

/* ===================================
   IN-CONTENT AD SECTIONS
   =================================== */

.ad-container-inline {
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.6) 0%, rgba(255, 255, 255, 0.6) 100%);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--ad-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2.5rem 0;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ad-container-inline:hover {
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.8) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

.ad-container-inline .ad-label {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-bottom: 1rem;
}

/* ===================================
   LOADING SKELETON
   =================================== */

.ad-skeleton {
    width: 100%;
    height: 100%;
    min-height: inherit;
    background: linear-gradient(90deg,
            rgba(240, 240, 240, 0.8) 25%,
            rgba(250, 250, 250, 0.9) 50%,
            rgba(240, 240, 240, 0.8) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.ad-skeleton::after {
    content: 'Loading Advertisement...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    color: var(--ad-label-color);
    font-weight: 500;
    opacity: 0.6;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ===================================
   AD CONTENT WRAPPER
   =================================== */

.ad-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Common ad sizes - ensure they're centered */
.ad-content ins,
.ad-content>div,
.ad-content>script+ins {
    margin: 0 auto;
    display: block;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1200px) {
    .ad-sidebar-container {
        top: 90px;
    }
}

@media (max-width: 991px) {

    /* Sidebar becomes full-width on tablet/mobile */
    .ad-sidebar-container {
        position: relative;
        top: auto;
        margin-bottom: 2rem;
    }

    .ad-container-sidebar {
        max-width: 100%;
        min-height: 200px;
    }

    .ad-container-header {
        padding: 0.75rem 0;
        min-height: 80px;
    }
}

@media (max-width: 768px) {
    .ad-container-header {
        padding: 0.5rem 0;
        min-height: 60px;
    }

    .ad-container-inline {
        padding: 1rem;
        margin: 1.5rem 0;
        min-height: 100px;
        border-width: 1.5px;
    }

    .ad-label {
        font-size: 0.6rem;
        letter-spacing: 1px;
    }

    .ad-skeleton::after {
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .ad-container-header {
        min-height: 50px;
    }

    .ad-container-sidebar {
        padding: 1rem;
        border-radius: 12px;
        min-height: 180px;
    }

    .ad-container-inline {
        padding: 0.875rem;
        border-radius: 10px;
    }

    .ad-label {
        font-size: 0.55rem;
    }
}

/* ===================================
   SPECIAL STATES
   =================================== */

/* Empty ad state - hide container if no ad */
.ad-container-header:empty,
.ad-container-sidebar:empty,
.ad-container-inline:empty {
    display: none;
    min-height: 0;
    padding: 0;
    margin: 0;
}

/* Ad loaded state */
.ad-container-header.ad-loaded,
.ad-container-sidebar.ad-loaded,
.ad-container-inline.ad-loaded {
    animation: fadeInAd 0.5s ease-in;
}

@keyframes fadeInAd {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Skip to content link should skip ads */
.skip-ad-link {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-ad-link:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    background: #fff;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}