/* Advertising Banner Styles - Image-Based Google Ads Style */

.ads-sidebar-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    min-height: 400px; /* Ensure minimum height for visibility */
}

/* Legacy fixed container - now unused */
.ads-container {
    display: none;
}

.ad-banner {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition-normal);
    border: 1px solid var(--border-secondary);
    width: 100%;
    height: auto;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
}

.ad-banner:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-glass);
    background: var(--bg-glass-hover);
}

/* Image-based banner */
.ad-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    transition: transform 0.3s ease;
    display: block;
    background-color: #f3f4f6;
}

.ad-banner:hover img {
    transform: scale(1.02);
}

/* Specific banner sizing - responsive within sidebar */
.ad-banner.banner-1 {
    min-height: 120px;
    aspect-ratio: 16/9;
}

.ad-banner.banner-2 {
    min-height: 130px;
    aspect-ratio: 16/9;
}

.ad-banner.banner-3 {
    min-height: 110px;
    aspect-ratio: 16/9;
}

/* Responsive ads within sidebar */
@media (max-width: 1024px) {
    .ads-sidebar-container {
        gap: 0.75rem;
    }
    
    .ad-banner.banner-1,
    .ad-banner.banner-2,
    .ad-banner.banner-3 {
        min-height: 90px;
    }
}

/* Image loading state with better fallback */
.ad-banner img {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 200%;
    animation: loading-shimmer 2s infinite;
    min-height: 120px;
    object-fit: cover;
}

.ad-banner img[src=""], 
.ad-banner img:not([src]) {
    opacity: 0;
}

/* Loading animation */
@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Better image error handling */
.ad-banner img[src*="placeholder"] {
    background: none;
    animation: none;
}

/* Fallback content for failed images */
.ad-banner::before {
    content: "";
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    z-index: 1;
}

.ad-banner::after {
    content: "🎯 Advertisement\AClick to Visit";
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: pre;
    line-height: 1.4;
    z-index: 2;
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* Show fallback when image fails */
.ad-banner.has-error::before {
    display: flex;
}

.ad-banner.has-error::after {
    display: block;
}

.ad-banner.has-error img {
    opacity: 0;
}

/* Ad Label */
.ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 8px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    font-family: Arial, sans-serif;
    font-weight: bold;
}

/* Close button */
.ad-close {
    position: absolute;
    top: 5px;
    right: 25px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
}

.ad-banner:hover .ad-close {
    display: flex;
}

.ad-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Mobile Ads Banner - Scrolling Right to Left */
.mobile-ads-banner {
    display: none;
    width: 100%;
    background: var(--bg-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    padding: 0.5rem 0;
}

.mobile-ads-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 80px;
}

.mobile-ads-track {
    display: flex;
    width: 300%; /* 3 ads = 300% */
    height: 100%;
    animation: scrollRightToLeft 15s linear infinite;
    /* 15s total = 5s per ad */
}

.mobile-ad-item {
    flex: 0 0 33.333%; /* Each ad takes 1/3 of track width */
    height: 80px;
    position: relative;
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 0 0.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.mobile-ad-item:hover {
    transform: translateY(-2px);
}

.mobile-ad-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius-md);
}

.mobile-ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: bold;
    z-index: 10;
}

.mobile-ads-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.indicator.active {
    background: var(--color-primary-light);
    transform: scale(1.2);
}

/* Scrolling animation */
@keyframes scrollRightToLeft {
    0% {
        transform: translateX(0%);
    }
    33.333% {
        transform: translateX(0%); /* Hold first ad */
    }
    33.334% {
        transform: translateX(-33.333%); /* Slide to second ad */
    }
    66.666% {
        transform: translateX(-33.333%); /* Hold second ad */
    }
    66.667% {
        transform: translateX(-66.666%); /* Slide to third ad */
    }
    100% {
        transform: translateX(-66.666%); /* Hold third ad */
    }
}

/* Pause animation on hover */
.mobile-ads-banner:hover .mobile-ads-track {
    animation-play-state: paused;
}

/* Mobile responsiveness - hide sidebar ads completely, show mobile sliding banners */
@media (max-width: 768px) {
    .sidebar-left {
        display: none !important;
    }
    
    .ads-sidebar-container {
        display: none !important;
    }
    
    .mobile-ads-banner {
        display: block;
    }
}

/* Animation entrance */
.ad-banner {
    animation: slideInLeft 0.6s ease-out forwards;
}

.ad-banner:nth-child(2) {
    animation-delay: 0.2s;
}

.ad-banner:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== 3D TEXT-BASED ADS ==================== */

/* Text-based ad container */
.ad-banner.text-ad {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    position: relative;
}

/* Remove image-specific styles for text ads */
.ad-banner.text-ad img {
    display: none;
}

/* Text content container */
.ad-text-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 2;
    position: relative;
}

/* Main text with 3D effect */
.ad-main-text {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
    color: #ffffff;
    text-shadow: 
        0 1px 0 #ccc,
        0 2px 0 #c9c9c9,
        0 3px 0 #bbb,
        0 4px 0 #b9b9b9,
        0 5px 0 #aaa,
        0 6px 1px rgba(0,0,0,.1),
        0 0 5px rgba(0,0,0,.1),
        0 1px 3px rgba(0,0,0,.3),
        0 3px 5px rgba(0,0,0,.2),
        0 5px 10px rgba(0,0,0,.25);
    transform: perspective(500px) rotateX(15deg);
    animation: glow 2s ease-in-out infinite alternate;
}

/* Sub text */
.ad-sub-text {
    font-family: 'Arial', sans-serif;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.4rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    opacity: 0.95;
}

/* Call-to-action text */
.ad-cta {
    font-family: 'Arial', sans-serif;
    font-size: clamp(0.6rem, 1.3vw, 0.8rem);
    font-weight: bold;
    color: #ffd700;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(255,215,0,0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Different color schemes for each banner - Darker & Beautiful */
.ad-banner.banner-1.text-ad {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 70%, #533483 100%);
    border: 2px solid rgba(102, 126, 234, 0.4);
    box-shadow: 
        0 8px 32px rgba(83, 52, 131, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(102, 126, 234, 0.2);
}

.ad-banner.banner-1.text-ad .ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #1a1a2e,
        0 3px 0 #16213e,
        0 4px 0 #0f3460,
        0 5px 0 #533483,
        0 6px 1px rgba(0,0,0,.3),
        0 0 10px rgba(102,126,234,.4),
        0 2px 4px rgba(0,0,0,.5),
        0 4px 8px rgba(102,126,234,.3),
        0 6px 12px rgba(83,52,131,.4);
}

.ad-banner.banner-2.text-ad {
    background: linear-gradient(135deg, #2d1b69 0%, #11001c 30%, #3c1053 70%, #8b0a50 100%);
    border: 2px solid rgba(240, 147, 251, 0.4);
    box-shadow: 
        0 8px 32px rgba(139, 10, 80, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(240, 147, 251, 0.2);
}

.ad-banner.banner-2.text-ad .ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #2d1b69,
        0 3px 0 #11001c,
        0 4px 0 #3c1053,
        0 5px 0 #8b0a50,
        0 6px 1px rgba(0,0,0,.3),
        0 0 10px rgba(240,147,251,.4),
        0 2px 4px rgba(0,0,0,.5),
        0 4px 8px rgba(240,147,251,.3),
        0 6px 12px rgba(139,10,80,.4);
}

.ad-banner.banner-3.text-ad {
    background: linear-gradient(135deg, #0c1445 0%, #1e3c72 30%, #2a5298 70%, #004e92 100%);
    border: 2px solid rgba(79, 172, 254, 0.4);
    box-shadow: 
        0 8px 32px rgba(0, 78, 146, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(79, 172, 254, 0.2);
}

.ad-banner.banner-3.text-ad .ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #0c1445,
        0 3px 0 #1e3c72,
        0 4px 0 #2a5298,
        0 5px 0 #004e92,
        0 6px 1px rgba(0,0,0,.3),
        0 0 10px rgba(79,172,254,.4),
        0 2px 4px rgba(0,0,0,.5),
        0 4px 8px rgba(79,172,254,.3),
        0 6px 12px rgba(0,78,146,.4);
}

/* Glow animation */
@keyframes glow {
    from {
        text-shadow: 
            0 1px 0 #ccc,
            0 2px 0 #c9c9c9,
            0 3px 0 #bbb,
            0 4px 0 #b9b9b9,
            0 5px 0 #aaa,
            0 6px 1px rgba(0,0,0,.1),
            0 0 5px rgba(0,0,0,.1),
            0 1px 3px rgba(0,0,0,.3),
            0 3px 5px rgba(0,0,0,.2),
            0 5px 10px rgba(0,0,0,.25);
    }
    to {
        text-shadow: 
            0 1px 0 #ccc,
            0 2px 0 #c9c9c9,
            0 3px 0 #bbb,
            0 4px 0 #b9b9b9,
            0 5px 0 #aaa,
            0 6px 1px rgba(0,0,0,.1),
            0 0 20px rgba(255,255,255,.6),
            0 1px 3px rgba(0,0,0,.3),
            0 3px 5px rgba(255,255,255,.2),
            0 5px 10px rgba(255,255,255,.25);
    }
}

/* Pulse animation for CTA */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hover effects for text ads */
.ad-banner.text-ad:hover .ad-main-text {
    transform: perspective(500px) rotateX(15deg) scale(1.02);
    transition: transform 0.3s ease;
}

.ad-banner.text-ad:hover .ad-cta {
    animation-duration: 0.8s;
}

/* Responsive adjustments for text ads */
@media (max-width: 1024px) {
    .ad-text-content {
        padding: 0.8rem;
    }
    
    .ad-main-text {
        font-size: clamp(1rem, 2.5vw, 1.4rem);
        letter-spacing: 1px;
    }
    
    .ad-sub-text {
        font-size: clamp(0.6rem, 1.5vw, 0.8rem);
    }
    
    .ad-cta {
        font-size: clamp(0.5rem, 1.3vw, 0.7rem);
    }
}

/* ==================== MOBILE SLIDING 3D TEXT ADS ==================== */

/* Mobile text-based ad container */
.mobile-ad-item.mobile-text-ad {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Remove image-specific styles for mobile text ads */
.mobile-ad-item.mobile-text-ad img {
    display: none;
}

/* Mobile text content container */
.mobile-ad-text-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    z-index: 2;
    position: relative;
}

/* Mobile main text with 3D effect - Enhanced visibility */
.mobile-ad-main-text {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: clamp(1.1rem, 5vw, 1.4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.2rem;
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #000,
        0 3px 0 #000,
        0 4px 0 #000,
        0 5px 0 #000,
        0 3px 1px rgba(0,0,0,.8),
        0 0 10px rgba(0,0,0,.5),
        0 1px 3px rgba(0,0,0,.7),
        0 3px 5px rgba(0,0,0,.4);
    transform: perspective(300px) rotateX(10deg);
    animation: mobileGlow 2s ease-in-out infinite alternate;
    -webkit-text-stroke: 1px rgba(0,0,0,0.3);
}

/* Mobile sub text - Enhanced visibility */
.mobile-ad-sub-text {
    font-family: 'Arial', sans-serif;
    font-size: clamp(0.6rem, 3vw, 0.8rem);
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.2rem;
    text-shadow: 
        0 1px 0 rgba(0,0,0,0.8),
        0 2px 0 rgba(0,0,0,0.6),
        0 2px 4px rgba(0,0,0,0.5);
    opacity: 1;
    line-height: 1.2;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.2);
}

/* Mobile call-to-action text - Enhanced visibility */
.mobile-ad-cta {
    font-family: 'Arial', sans-serif;
    font-size: clamp(0.55rem, 2.8vw, 0.75rem);
    font-weight: 900;
    color: #ffd700;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 
        0 1px 0 rgba(0,0,0,0.8),
        0 2px 0 rgba(0,0,0,0.6),
        0 2px 4px rgba(255,215,0,0.8);
    animation: mobilePulse 1.5s ease-in-out infinite;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.3);
}

/* Different color schemes for mobile banners - Darker & Beautiful */
.mobile-ad-item.mobile-banner-1 {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 70%, #533483 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 
        0 4px 16px rgba(83, 52, 131, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 10px rgba(102, 126, 234, 0.15);
}

.mobile-ad-item.mobile-banner-1 .mobile-ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #1a1a2e,
        0 3px 0 #16213e,
        0 4px 0 #533483,
        0 3px 1px rgba(0,0,0,.2),
        0 0 8px rgba(102,126,234,.3),
        0 1px 3px rgba(0,0,0,.4),
        0 3px 5px rgba(102,126,234,.2);
}

.mobile-ad-item.mobile-banner-2 {
    background: linear-gradient(135deg, #2d1b69 0%, #11001c 30%, #3c1053 70%, #8b0a50 100%);
    border: 1px solid rgba(240, 147, 251, 0.3);
    box-shadow: 
        0 4px 16px rgba(139, 10, 80, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 10px rgba(240, 147, 251, 0.15);
}

.mobile-ad-item.mobile-banner-2 .mobile-ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #2d1b69,
        0 3px 0 #11001c,
        0 4px 0 #8b0a50,
        0 3px 1px rgba(0,0,0,.2),
        0 0 8px rgba(240,147,251,.3),
        0 1px 3px rgba(0,0,0,.4),
        0 3px 5px rgba(240,147,251,.2);
}

.mobile-ad-item.mobile-banner-3 {
    background: linear-gradient(135deg, #0c1445 0%, #1e3c72 30%, #2a5298 70%, #004e92 100%);
    border: 1px solid rgba(79, 172, 254, 0.3);
    box-shadow: 
        0 4px 16px rgba(0, 78, 146, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 10px rgba(79, 172, 254, 0.15);
}

.mobile-ad-item.mobile-banner-3 .mobile-ad-main-text {
    color: #ffffff;
    text-shadow: 
        0 1px 0 #000,
        0 2px 0 #0c1445,
        0 3px 0 #1e3c72,
        0 4px 0 #004e92,
        0 3px 1px rgba(0,0,0,.2),
        0 0 8px rgba(79,172,254,.3),
        0 1px 3px rgba(0,0,0,.4),
        0 3px 5px rgba(79,172,254,.2);
}

/* Mobile glow animation */
@keyframes mobileGlow {
    from {
        text-shadow: 
            0 1px 0 #ccc,
            0 2px 0 #c9c9c9,
            0 3px 0 #bbb,
            0 4px 0 #b9b9b9,
            0 5px 0 #aaa,
            0 3px 1px rgba(0,0,0,.1),
            0 0 5px rgba(0,0,0,.1),
            0 1px 3px rgba(0,0,0,.3),
            0 3px 5px rgba(0,0,0,.2);
    }
    to {
        text-shadow: 
            0 1px 0 #ccc,
            0 2px 0 #c9c9c9,
            0 3px 0 #bbb,
            0 4px 0 #b9b9b9,
            0 5px 0 #aaa,
            0 3px 1px rgba(0,0,0,.1),
            0 0 15px rgba(255,255,255,.4),
            0 1px 3px rgba(0,0,0,.3),
            0 3px 5px rgba(255,255,255,.1);
    }
}

/* Mobile pulse animation for CTA */
@keyframes mobilePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.03);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile hover effects */
.mobile-ad-item.mobile-text-ad:hover .mobile-ad-main-text {
    transform: perspective(300px) rotateX(10deg) scale(1.01);
    transition: transform 0.2s ease;
}

.mobile-ad-item.mobile-text-ad:hover .mobile-ad-cta {
    animation-duration: 0.8s;
}
