/* =================================
    AD STYLES (v4.1 - Text Visibility Fix)
    ================================= */

/* --- 1. Multi-Ad Grid Styles --- */
#ad-slot-header, #ad-slot-search, #ad-slot-sidebar {
    width: 100%;
    display: none; /* Hide if no ads are injected */
}
.ad-row-wrapper {
    margin-bottom: 1rem;
}
.ad-col-wrapper {
    display: flex;
    flex-direction: column;
}

/* --- 2. Outer Ad Box Styles --- */
.ad-slot {
    width: 100%;
    margin: 0;
    text-align: center;
    overflow: visible; /* Changed from hidden */
    background-color: transparent;
    border: none;
    border-radius: 0.75rem;
    padding: 0;
    height: 100%;
}

/* --- 3. Inner Ad Wrapper Styles --- */
.ad-inner-wrapper {
    padding: 10px;
    border-radius: 0.75rem;
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-light);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden; /* Keep overflow hidden here for wrapper-level constraints like max-height */
}
body.dark-mode .ad-inner-wrapper {
    background-color: var(--card-bg-dark);
    border: 1px solid var(--border-dark);
}

/* --- 4. Custom Title/Description Styles (Defaults) --- */
/* *** UPDATED: Text Visibility Fix *** */
.ad-custom-title,
.ad-custom-description {
    font-family: var(--font-heading);
    margin-bottom: 4px;
    padding: 0 5px;
    text-align: inherit;
    /* Remove text manipulation styles that might cause issues */
    /* overflow: hidden; */ /* REMOVED */
    /* white-space: nowrap; */ /* REMOVED - Let text wrap by default */
    text-overflow: clip; /* Ensure text isn't replaced by ellipsis */
    line-height: 1.4; /* Ensure reasonable line height */
    word-break: break-word; /* Allow long words to break */
}

.ad-custom-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted-light);
}

.ad-custom-description {
    font-size: 0.8rem;
    color: var(--text-muted-light);
    margin-bottom: 8px;
}

/* Specific style for Marquee using the span */
.ad-custom-title span[style*="ad-anim-marqueeLeft"],
.ad-custom-description span[style*="ad-anim-marqueeLeft"] {
    display: inline-block; /* Needed for transform */
    white-space: nowrap; /* Keep marquee text on one line */
    /* Animation style is applied inline by JS */
}
/* Ensure the parent hides overflow ONLY when marquee is active */
.ad-custom-title:has(span[style*="ad-anim-marqueeLeft"]),
.ad-custom-description:has(span[style*="ad-anim-marqueeLeft"]) {
    overflow: hidden;
    white-space: nowrap; /* Prevent parent from wrapping if child is marquee */
}


body.dark-mode .ad-custom-title,
body.dark-mode .ad-custom-description {
    color: var(--text-muted-dark);
}

/* --- 5. Ad Content Area --- */
.ad-banner-content {
    line-height: normal; /* Changed from 0 */
    text-align: inherit;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden; /* Keep hidden for content like images that might exceed bounds */
}

/* --- 6. Custom Ad Type Specific Styles --- */
/* Image ads */
.ad-banner-content .ad-image-link img,
.ad-banner-content .ad-image-only {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    display: inline-block;
}

/* Text ads */
/* *** UPDATED: Text Visibility Fix *** */
.ad-banner-content .ad-text-link,
.ad-banner-content .ad-text-only {
    display: block;
    padding: 0.5rem;
    font-size: 1rem;
    text-align: inherit;
    line-height: 1.5;
    /* Remove text manipulation styles that might cause issues */
    /* overflow: hidden; */ /* REMOVED */
    /* white-space: nowrap; */ /* REMOVED - Let text wrap by default */
    text-overflow: clip;
    word-break: break-word;
}
.ad-banner-content .ad-text-link {
    color: var(--primary-color);
    text-decoration: underline;
}
.ad-banner-content .ad-text-only {
    color: var(--text-light);
}
body.dark-mode .ad-banner-content .ad-text-only {
     color: var(--text-dark);
}

/* Specific style for Marquee using the span */
.ad-banner-content .ad-text-link span[style*="ad-anim-marqueeLeft"],
.ad-banner-content .ad-text-only span[style*="ad-anim-marqueeLeft"] {
     display: inline-block; /* Needed for transform */
     white-space: nowrap; /* Keep marquee text on one line */
     /* Animation style is applied inline by JS */
}
/* Ensure the parent hides overflow ONLY when marquee is active */
.ad-banner-content .ad-text-link:has(span[style*="ad-anim-marqueeLeft"]),
.ad-banner-content .ad-text-only:has(span[style*="ad-anim-marqueeLeft"]) {
    overflow: hidden;
    white-space: nowrap; /* Prevent parent from wrapping if child is marquee */
}


/* --- 7. Animation Keyframes --- */
/* (Purano keyframes haru jastai rakhne) */
@keyframes ad-anim-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes ad-anim-slideInLeft { from { transform: translateX(-50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes ad-anim-slideInRight { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes ad-anim-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes ad-anim-glow { 0% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.5); } 50% { box-shadow: 0 0 20px rgba(0, 123, 255, 1); } 100% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.5); } }
@keyframes ad-anim-tada { from { transform: scale3d(1, 1, 1); } 10%, 20% { transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); } 30%, 50%, 70%, 90% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); } 40%, 60%, 80% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); } to { transform: scale3d(1, 1, 1); } }
@keyframes ad-anim-marqueeLeft { 0% { transform: translateX(0%); } 100% { transform: translateX(-100%); } } /* Updated: Start from 0% for inline-block */
