/* ============================================
   Advertisements — estilos dos anúncios
   ============================================ */

/* Carrossel de banners */
.ad-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 1248 / 250;
    height: auto;
    max-height: 250px;
    margin: 0 0 24px 0;
    overflow: hidden;
    border-radius: 12px;
    box-sizing: border-box;
}

.ad-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
}

.ad-carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.banner-text-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 2;
    max-width: 70%;
}

.banner-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.banner-subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

.banner-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.banner-link:hover {
    text-decoration: none;
}

/* Reader preview ad pages */
.reel-page-ad {
    background: #000;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reel-page-ad .ad-script-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.reel-ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.reel-ad-content .ad-link,
.reel-ad-content .ad-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.reel-ad-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ad-carousel-slide .ad-link {
    display: block;
    width: 100%;
    text-align: center;
}

.ad-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.ad-carousel-prev {
    left: 8px;
}

.ad-carousel-next {
    right: 8px;
}

.ad-carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.ad-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.2s;
}

.ad-carousel-dot.active {
    background: rgba(255, 255, 255, 0.9);
}

/* Card de anúncio na home */
.ad-card-wrapper {
    transform: translateZ(0);
    position: relative;
    isolation: isolate;
}

.ad-card {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

a.ad-card:hover {
    text-decoration: none;
    color: inherit;
}

.ad-card-content {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .ad-card-content {
    background: rgba(255, 255, 255, 0.02);
}

.ad-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    z-index: 2;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

/* Popup de preview no reader */
.ad-preview-popup {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
    max-width: 320px;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: adPopupIn 0.3s ease-out;
}

[data-theme="dark"] .ad-preview-popup {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.ad-preview-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ad-preview-content {
    padding: 8px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes adPopupIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebars laterais na home */
.ad-sidebar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    max-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-sidebar-left {
    left: 16px;
    margin-left: 16px;
}

.ad-sidebar-right {
    right: 16px;
    margin-right: 16px;
}

.ad-sidebar .ad-link {
    display: block;
    text-decoration: none;
}

.ad-sidebar .ad-script-container {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden;
}

/* Anúncio acima do footer - Desktop */
.ad-footer-desktop {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 32px auto;
    padding: 0 16px;
}

@media (max-width: 750px) {
    .ad-footer-desktop {
        display: none;
    }
}

/* Footer Mobile */
.ad-footer-mobile {
    display: none;
}

@media (max-width: 750px) {
    .ad-footer-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 24px auto;
        padding: 0 16px;
        width: 100%;
        max-width: 320px;
        min-height: 50px;
    }
    
    .ad-footer-mobile .ad-script-container,
    .ad-footer-mobile-script {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }
}

/* Fixed bottom ad banner (mobile reader) */
.reel-ad-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.reel-ad-bottom-content {
    max-width: 400px;
    margin: 0 auto;
    padding: 8px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    min-height: 100px;
    min-width: 280px;
}

.reel-ad-bottom-content > div {
    width: 100%;
    height: 100%;
    min-height: 90px;
}

.reel-ad-bottom .ad-link,
.reel-ad-bottom .ad-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

@media (max-width: 480px) {
    .reel-ad-bottom {
        padding: 4px 8px;
    }
    .reel-ad-bottom-content {
        border-radius: 6px;
    }
}

/* Desktop ad - bottom right corner */
.cinema-ad-fixed {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    max-width: 320px;
}

.cinema-ad-fixed:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.cinema-ad-fixed .cinema-ad-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 150px;
    min-width: 200px;
    background: #000;
    position: relative;
}

.cinema-ad-fixed .ad-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Mobile reader preview - bottom centered */
@media (max-width: 768px) {
    .cinema-ad-fixed {
        bottom: 16px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: calc(100% - 32px);
        width: auto;
    }
    
    .cinema-ad-fixed:hover {
        transform: translateX(-50%) scale(1.02);
    }
    
    .cinema-ad-fixed .cinema-ad-content {
        min-width: auto;
        min-height: auto;
        width: 100%;
    }
    
    .cinema-ad-fixed .ad-script-container {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }
}
@media (max-width: 768px) {
    .ad-carousel {
        margin-bottom: 16px;
        border-radius: 8px;
        aspect-ratio: 16 / 9;
        max-height: 180px;
    }
    .ad-carousel-slide img {
        object-position: center center;
    }
    .banner-text-overlay {
        bottom: 12px;
        left: 12px;
        max-width: 85%;
    }
    .banner-title {
        font-size: 1.1rem;
    }

    .ad-preview-popup {
        bottom: 8px;
        right: 8px;
        max-width: 260px;
    }
}

@media (max-width: 1700px) {
    .ad-sidebar {
        display: none;
    }
}

@media (max-width: 800px) {
    .ad-footer-desktop {
        display: none;
    }
}
