/**
 * Unified Ad Container Styles
 *
 * Provides consistent styling for all ad formats
 * with smart refresh and countdown timer support
 */

/* Unified placement wrapper for all ad formats (except sticky/interstitial) */
.adlogic-placement-wrapper {
    /* Vertical spacing controlled by inline styles per ad slot — NO !important so inline overrides work */
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    /* Remove horizontal margins - centering handled by parent's text-align */
    margin-left: auto !important;
    margin-right: auto !important;
    /* Remove horizontal padding to prevent cropping in narrow spaces */
    padding-left: 0 !important;
    padding-right: 0 !important;
    /* Display properties */
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    text-align: left;
    /* Ensure wrapper contains all child elements */
    position: relative;
}

/* Hide placement wrapper for display ads until ad loads (only when NOT reserving space).
   IMPORTANT: Use visibility:hidden (NOT display:none) because GPT refuses
   to fetch ads for slots inside display:none containers, creating a deadlock
   where the container waits for the ad to load but GPT won't load it.
   NOTE: Do NOT use height:0 here — it prevents GPT's IntersectionObserver
   from detecting the slot, causing "Ad unit did not fetch" when lazy loading
   is enabled. Instead we use a 1px min-height with overflow:hidden so the
   element has non-zero dimensions for IntersectionObserver while taking
   minimal visual space. */
.adlogic-placement-wrapper:has(.adlogic-display-container:not([data-ad-loaded="true"]):not([data-reserve-space])) {
    visibility: hidden !important;
    min-height: 1px !important;
    max-height: 1px !important;
    overflow: hidden !important;
    margin: 0 !important;
    pointer-events: none !important;
}

/* When reserve_space is enabled, show wrapper at reserved size before ad loads.
   Content is invisible but space is held to prevent CLS.
   Uses inline-flex for both horizontal and vertical centering of ads within the box. */
.adlogic-placement-wrapper:has([data-reserve-space]:not([data-ad-loaded="true"])) {
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    pointer-events: auto !important;
    margin-top: 0;
    margin-bottom: 0;
}

/* Hide the ad content (not the wrapper) until ad loads when reserving space */
[data-reserve-space]:not([data-ad-loaded="true"]) .adlogic-gpt-slot {
    visibility: hidden;
}

/* Show ad content once loaded */
[data-reserve-space][data-ad-loaded="true"] .adlogic-gpt-slot {
    visibility: visible;
}

/* CLS Placeholder: flex centering on all placement containers. */
.adlogic-content-placement,
.adlogic-before-content-placement,
.adlogic-after-content-placement,
.adlogic-header-placement:not(:empty),
.adlogic-footer-placement:not(:empty) {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

/* Exclude video containers from grey placeholder background */
.adlogic-placement-wrapper-video,
.adlogic-placement-wrapper:has(.adlogic-video-container) {
    background-color: transparent !important;
    border: none !important;
}

/* Show placement wrapper when display ad is loaded - keep flex centering */
.adlogic-placement-wrapper:has(.adlogic-display-container[data-ad-loaded="true"]) {
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
}

/* Responsive wrapper inside placement wrapper */
.adlogic-responsive-wrapper {
    display: inline-block !important;
    width: auto !important;
    position: relative;
}

/* Video placement wrapper takes full width */
.adlogic-placement-wrapper:has(.adlogic-video-container) {
    width: 100% !important;
    max-width: 100% !important;
}

/* Remove placement wrapper margin for sticky ads since they're positioned fixed */
.adlogic-placement-wrapper:has(.adlogic-sticky-container) {
    margin: 0;
}

/* Base container styles for display, video, and cube ads.
   Exclude .adlogic-display-slot — single-div display slots handle their own
   spacing via inline styles, so !important margin/padding overrides must not apply. */
.adlogic-display-container:not(.adlogic-display-slot),
.adlogic-video-container,
.adlogic-cube-container {
    position: relative;
    display: inline-block !important;
    max-width: 100%;
    border-radius: 8px;
    background: transparent;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.3s ease;
    overflow: visible;
    min-height: 0;
    vertical-align: top;
}

/* Hide display container initially until ad loads.
   Use visibility:hidden to keep element in rendering tree for GPT.
   Excludes single-div display slots — they handle visibility via .adlogic-display-slot rules. */
.adlogic-display-container:not(.adlogic-display-slot):not([data-ad-loaded="true"]) {
    visibility: hidden !important;
}

/* CLS: Grey background on the sized display container while ad loads (legacy nested structure) */
.adlogic-display-container:not(.adlogic-display-slot)[data-reserve-space]:not([data-ad-loaded="true"]) {
    visibility: visible !important;
    background-color: #f9f9f9 !important;
    background: #f9f9f9 !important;
    border: 1px solid #f1f1f1 !important;
    border-radius: 4px;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
}

/* Clear grey background once ad loads (legacy nested structure) */
.adlogic-display-container:not(.adlogic-display-slot)[data-reserve-space][data-ad-loaded="true"] {
    background-color: transparent !important;
    background: transparent !important;
    border-color: transparent !important;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Hide NoAdCode branding until ad loads for display ads */
.adlogic-display-container:not([data-ad-loaded="true"]) .noadcode-branding {
    display: none !important;
}

/* Ensure display container NoAdCode branding stays within parent */
.adlogic-display-container .noadcode-branding {
    z-index: auto !important;
    position: absolute;
}

/* Force display containers to create isolated stacking contexts */
body .adlogic-display-container:not(.adlogic-display-slot),
body .adlogic-placement-wrapper:has(.adlogic-display-container) {
    isolation: isolate !important;
    position: relative;
}

/* Show legacy container when ad is loaded */
.adlogic-display-container:not(.adlogic-display-slot)[data-ad-loaded="true"] {
    visibility: visible !important;
    display: inline-block !important;
}

/* ==========================================================================
   Single-div display slot (consolidated from 5 nested divs)
   The single div carries adlogic-display-container + adlogic-gpt-slot,
   so most existing rules above already apply. These overrides undo
   conflicting rules from .adlogic-display-container that assumed nested
   structure (e.g. padding:0 was for the inner container, not the outer).
   ========================================================================== */

/* Single-div display slot: block-level, self-positioning, inline styles
   control padding/margin/width. No parent wrapper needed. */
.adlogic-display-slot {
    display: block !important;
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    max-width: 100%;
    overflow: visible;
    background: transparent;
    transition: all 0.3s ease;
}

/* After ad loads, display slots stay full-width.
   Ad creative is centered via text-align:center inside. */
.adlogic-display-slot[data-ad-loaded="true"] {
    display: block !important;
    width: 100% !important;
}

/* Display slots with grey background: shrink to ad size so background wraps tightly */
.adlogic-display-slot.adlogic-grey-bg[data-ad-loaded="true"] {
    width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Universal close button for containers - clean X mark, no box */
.adlogic-container-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--adlogic-z-display-controls, 1002);
    box-shadow: none;
    transition: opacity 0.2s ease;
    opacity: 0;
    visibility: hidden;
    padding: 0;
}

/* X mark — clean, centered lines */
.adlogic-container-close::before,
.adlogic-container-close::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2.5px;
    background: #9e9e9e;
    border-radius: 1px;
    top: 50%;
    left: 50%;
}
.adlogic-container-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.adlogic-container-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Show close button on container hover - only for interstitial (sticky is always visible) */
.adlogic-interstitial-container:hover .adlogic-container-close {
    opacity: 1;
    visibility: visible;
}

/* Generic close button hover */
.adlogic-container-close:hover {
    opacity: 0.7 !important;
}

.adlogic-container-close:active {
    opacity: 0.5 !important;
}

/* Premium black tab style NoAdCode branding */
.noadcode-branding {
    /* Positioning - moved to left to reserve space for close button */
    position: absolute;
    top: -28px;
    left: 0;
    /* No z-index - must inherit from parent container */
    
    /* Tab shape with only top-right corner rounded */
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.5em 1em 0.6em;
    border-radius: 0 8px 0 0;
    
    /* Premium black color scheme */
    background: #1a1a1a;
    color: #ffffff;
    text-decoration: none;
    border: none;
    outline: none;
    
    /* Typography - responsive sizing */
    font-size: clamp(9px, 2vw, 12px);
    font-weight: 500;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Effects with subtle inner shadow for depth */
    box-shadow: 
        inset 0 -1px 0 rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Ensure clickability */
    cursor: pointer;
    user-select: none;
    /* z-index will be set by specific ad type rules in z-index-hierarchy.css */
    
    /* Initially hidden until ad loads */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show branding when ad is loaded */
.adlogic-display-container[data-ad-loaded="true"] .noadcode-branding,
.adlogic-video-container[data-ad-loaded="true"] .noadcode-branding,
.adlogic-sticky-container[data-ad-loaded="true"] .noadcode-branding {
    opacity: 1;
    visibility: visible;
    animation: tabDropIn 0.6s ease-out;
}

/* Lightning icon styling with gold color - responsive */
.noadcode-branding .lightning-icon {
    color: #FFD700;
    font-size: 1.2em;
    line-height: 1;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
    animation: lightningPulse 10s infinite;
}

/* Branding text */
.noadcode-branding .branding-text {
    line-height: 1;
    color: #ffffff;
}

/* NoAdCode text with lightning pulse animation */
.noadcode-branding .noadcode-text {
    display: inline-block;
    font-weight: 600;
    animation: textLightningPulse 10s infinite;
}

/* Text lightning pulse animation - offset from icon */
@keyframes textLightningPulse {
    0%, 90% { 
        opacity: 1;
        text-shadow: none;
    }
    92% { 
        opacity: 0.8;
        text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    }
    93% { 
        opacity: 1;
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    }
    94% { 
        opacity: 0.9;
        text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
    }
    95%, 100% { 
        opacity: 1;
        text-shadow: none;
    }
}

/* Video container specific positioning */
.adlogic-video-container .noadcode-branding {
    top: 10px;
    left: 10px;
    right: auto;
    /* z-index handled by z-index-hierarchy.css based on floating state */
}

/* Video container specific styles */
.adlogic-video-container {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
}

/* Keep the lightning pulse animation */
@keyframes lightningPulse {
    0%, 95% { opacity: 1; }
    97% { opacity: 0.3; }
    98% { opacity: 1; }
    99% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Hover state - no expansion, just subtle highlight */
.noadcode-branding:hover {
    background: #000000;
    /* padding-bottom: 10px; -- removed to prevent expansion */
    box-shadow: 
        inset 0 -1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

/* Enhanced lightning effect on hover */
.noadcode-branding:hover .lightning-icon {
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.9),
                 0 0 20px rgba(255, 215, 0, 0.4);
}

/* Focus state for accessibility */
.noadcode-branding:focus {
    outline: none;
}

/* Tab drop-in animation */
@keyframes tabDropIn {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    60% {
        transform: translateY(10%);
    }
    80% {
        transform: translateY(-5%);
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Active/pressed state */
.noadcode-branding:active {
    transform: translateY(1px);
    box-shadow: 
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Tablet/Medium screens - 2 column layout */
@media (min-width: 768px) and (max-width: 1199px) {
    .adlogic-placement-wrapper {
        display: inline-block !important;
        vertical-align: top !important;
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: auto !important;
        max-width: 100% !important;
    }

    .adlogic-placement-wrapper:has(.adlogic-cube-container) {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .adlogic-placement-wrapper:has(.adlogic-video-container) {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}

/* Desktop - 3 column layout */
@media (min-width: 1200px) {
    .adlogic-placement-wrapper {
        display: inline-block !important;
        vertical-align: top !important;
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: auto !important;
        max-width: 100% !important;
    }

    .adlogic-placement-wrapper:has(.adlogic-cube-container) {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .adlogic-placement-wrapper:has(.adlogic-video-container) {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}

/* Extra large desktop */
@media (min-width: 1600px) {
    .adlogic-placement-wrapper {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: auto !important;
        max-width: 100% !important;
    }
}

/* Mobile adjustments - ensure consistent centering */
@media (max-width: 767px) {
    .adlogic-placement-wrapper {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        display: inline-block !important;
        width: auto !important;
    }

    .adlogic-placement-wrapper:has(.adlogic-cube-container) {
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .noadcode-branding {
        font-size: clamp(8px, 2.5vw, 11px);
        padding: 0.4em 0.8em 0.5em;
        border-radius: 6px 6px 0 0;
    }
    
    .noadcode-branding .lightning-icon {
        font-size: 1.2em;
    }
    
    /* Mobile hover - no expansion */
    .noadcode-branding:hover {
        /* Keep same padding to prevent expansion */
        padding: 5px 12px 6px;
    }
}

/* Dark mode support - maintain same design */
@media (prefers-color-scheme: dark) {
    .noadcode-branding {
        /* Keep the same black tab design in dark mode */
        background: #1a1a1a;
        color: #ffffff;
        box-shadow: 
            inset 0 -1px 0 rgba(255, 255, 255, 0.1),
            0 2px 8px rgba(0, 0, 0, 0.4);
    }
    
    .noadcode-branding:hover {
        background: #000000;
        /* No padding change to prevent expansion */
        box-shadow: 
            inset 0 -1px 0 rgba(255, 255, 255, 0.1),
            0 4px 12px rgba(0, 0, 0, 0.5);
    }
}

/* Format-specific container styles */
.adlogic-display-container {
    text-align: left;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    /* display already set in base styles */
    position: relative;
    isolation: isolate !important; /* Create isolated stacking context */
}

/* Sticky container - no styling to preserve original behavior */
.adlogic-sticky-container {
    /* Sticky ads handle their own positioning and styling */
    position: relative;
}

/* Hide label for sticky */
.adlogic-sticky-container::before {
    display: none !important;
}

/* Sticky Container Structure */
.adlogic-sticky-container {
    position: fixed !important;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--adlogic-z-sticky-base, 10000); /* Sticky layer */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    /* Width will be set dynamically by container-handler.js based on actual ad size */
    max-width: 100vw; /* Prevent overflow on small screens */
    overflow: visible; /* Allow branding and close button to extend outside */
    /* Remove padding to let ad size naturally */
    padding: 0;
    box-sizing: border-box;
    /* Initially hidden until ad loads.
       IMPORTANT: Use visibility:hidden instead of display:none because
       GPT refuses to fetch ads for slots inside display:none containers.
       Since this is position:fixed, visibility:hidden has no layout impact. */
    visibility: hidden;
    pointer-events: none;
}

/* Position sticky container based on data attribute */
.adlogic-sticky-container[data-position="bottom"] {
    bottom: 0;
}

.adlogic-sticky-container[data-position="top"] {
    top: 0;
}

/* Dynamic width will be set via JavaScript based on actual GPT sizes */
/* Default responsive handling for smaller screens */
@media (max-width: 768px) {
    .adlogic-sticky-container[data-ad-loaded="true"] {
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        transform: none !important;
    }
    
    /* Update animations for mobile */
    .adlogic-sticky-container[data-ad-loaded="true"][data-position="bottom"] {
        animation: stickySlideInBottomMobile 0.6s ease-out;
    }
    
    .adlogic-sticky-container[data-ad-loaded="true"][data-position="top"] {
        animation: stickySlideInTopMobile 0.6s ease-out;
    }
}

/* Mobile animations */
@keyframes stickySlideInBottomMobile {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* NoAdCode branding in sticky container - hidden initially like display */
.adlogic-sticky-container .noadcode-branding {
    /* Position it absolutely at top */
    position: absolute;
    top: -26px !important;
    left: 0;
    /* Initially hidden like display ads */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

/* Timer container for sticky ads - white background tab */
.adlogic-timer-container {
    position: absolute;
    top: -26px; /* Position above container */
    right: 37px; /* Leave space for close button */
    display: none; /* Initially completely hidden to prevent white dot */
    align-items: center;
    padding: 4px 4px;
    border-radius: 4px 4px 0 0;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: var(--adlogic-z-display-controls, 1002); /* Display ad controls layer */
    /* Transition for smooth appearance */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

/* Show timer container as flex when active */
.adlogic-timer-container.timer-active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Timer styling inside timer container */
.adlogic-timer-container .adlogic-timer-mount {
    position: static;
    opacity: 1;
    margin: 0;
    padding: 0;
    font-size: 11px;
    color: #333;
}

/* Countdown text in timer container */
.adlogic-timer-container .adlogic-countdown-text {
    padding-bottom: 0;
    font-size: 11px;
    color: #333;
}

/* Close button for sticky container - clean X mark, no box */
.adlogic-sticky-container .adlogic-container-close {
    position: absolute;
    height: 36px;
    width: 36px;
    top: -38px;
    right: 0;
    display: block;
    background: transparent !important;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    box-shadow: none;
}

.adlogic-sticky-container .adlogic-container-close:hover {
    background: transparent !important;
    box-shadow: none;
    opacity: 0.7 !important;
}

.adlogic-sticky-container .adlogic-container-close:active {
    background: transparent !important;
    opacity: 0.5 !important;
}

/* X mark — clean, centered lines */
.adlogic-sticky-container .adlogic-container-close::before,
.adlogic-sticky-container .adlogic-container-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #5f6368;
    border-radius: 1px;
    top: 50%;
    left: 50%;
}
.adlogic-sticky-container .adlogic-container-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.adlogic-sticky-container .adlogic-container-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Show sticky container when ad is loaded */
.adlogic-sticky-container[data-ad-loaded="true"] {
    visibility: visible;
    pointer-events: auto;
}

/* Show close button when ad is loaded */
.adlogic-sticky-container[data-ad-loaded="true"] .adlogic-container-close {
    opacity: 1;
    visibility: visible;
}

/* Only show timer container when it has actual countdown content */
.adlogic-sticky-container[data-ad-loaded="true"] .adlogic-timer-container:has(.adlogic-countdown-text) {
    opacity: 1;
    visibility: visible;
}

/* Timer mount for sticky ads is handled by timer container */

/* Let sticky ad containers size naturally based on content */
/* Height will be set by GPT when ad loads */

/* Sticky content area */
.adlogic-sticky-container .adlogic-sticky-content {
    position: relative !important;
    background: transparent;
    margin: 0;
    padding: 0;
    /* Let content size naturally based on ad */
    width: 100%;
    height: auto;
}

/* Cube container - no additional styling to preserve 3D effect */
.adlogic-cube-container {
    /* Cube ads handle their own 3D styling */
    position: relative;
    /* display already set in base styles */
    text-align: left; /* Ensure cube aligns left when inline */
}

/* Hide label for cube */
.adlogic-cube-container::before {
    display: none !important;
}

.adlogic-video-container {
    background: transparent;
    position: relative;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

/* Interstitial container - no styling to preserve original behavior */
.adlogic-interstitial-container {
    /* Interstitial ads handle their own overlay */
    position: relative;
}

/* Hide label for interstitial */
.adlogic-interstitial-container::before {
    display: none !important;
}

/* Video wrapper for special handling */
.adlogic-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Timer mount point */
.adlogic-timer-mount {
    position: absolute;
    top: -25px;
    right: 3px;
    height: auto;
    background: transparent;
    z-index: var(--adlogic-z-display-content, 1001); /* Display ad content layer */
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 10px;
    color: #666;
    pointer-events: none;
}

/* Show timer when countdown is active */
.adlogic-container[data-countdown-active="true"] .adlogic-timer-mount,
.adlogic-display-container[data-countdown-active="true"] .adlogic-timer-mount {
    opacity: 1;
}

/* Timer container layout */
.adlogic-timer-content {
    display: block;
    text-align: right;
}


/* Countdown text */
.adlogic-countdown-text {
    font-weight: 400;
    font-size: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    padding-bottom: 5px;
    margin-left: 0;
}


/* Countdown number circle */
.adlogic-countdown-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%) !important;
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
}

/* Format-specific timer positioning */
.adlogic-sticky-container .adlogic-timer-mount {
    /* For sticky ads at bottom, show timer at top */
    top: 0;
    bottom: auto;
}

.adlogic-sticky-container[data-position="top"] .adlogic-timer-mount {
    /* For sticky ads at top, show timer at bottom */
    top: auto;
    bottom: 0;
}

.adlogic-video-container .adlogic-timer-mount {
    /* For video ads, show timer above controls */
    bottom: 40px;
}

/* Hide timer for formats that don't support it */
.adlogic-cube-container .adlogic-timer-mount,
.adlogic-interstitial-container .adlogic-timer-mount {
    display: none;
}

/* Refresh animation */
@keyframes adlogicRefreshPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.adlogic-container[data-refreshing="true"] {
    animation: adlogicRefreshPulse 0.6s ease-in-out;
}

/* Accessibility improvements - removed to prevent unwanted borders */

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .adlogic-timer-mount {
        height: 3px;
    }
    
    .adlogic-video-container .adlogic-timer-mount {
        bottom: 30px;
    }
    
    /* Ensure placement wrapper and display containers maintain inline-block on mobile */
    .adlogic-placement-wrapper {
        display: inline-block !important;
        width: auto !important;
        max-width: 100% !important;
        text-align: left !important;
    }
    
    .adlogic-display-container {
        display: inline-block !important;
        width: auto !important;
        max-width: 100% !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .adlogic-timer-mount {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .adlogic-container[data-refreshing="true"] {
        animation: none;
    }
}