/**
 * FAds CSS Styling
 * Luxury-themed ad styling matching the site design
 */

/* ==================== CONTENT AD ==================== */
.fads-content-ad {
    margin: 48px 0;
    padding: 32px 0;
    text-align: center;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    position: relative;
    /* CLS Fix: Reserve space for ad */
    min-height: 150px;
    contain: layout;
}

.fads-content-ad::before {
    content: 'SPONSORED';
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    color: #999;
    margin-bottom: 16px;
    font-weight: 600;
}

.fads-content-ad a {
    display: inline-block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fads-content-ad a:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.2);
}

.fads-content-ad img {
    display: block;
    max-width: 100%;
    width: auto;
    /* Allow natural width */
    height: auto;
    margin: 0 auto;
    border-radius: 4px;
    /* Optional: slight rounding */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* CLS Fix: Aspect ratio removed to support various ad sizes */
    /* aspect-ratio: 728 / 90; */
    object-fit: contain;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .fads-content-ad {
        margin: 32px 0;
        padding: 24px 0;
        min-height: 100px;
    }

    .fads-content-ad img {
        aspect-ratio: 320 / 100;
    }
}

/* ==================== FOOTER POPUP (STICKY BAR) ==================== */
.fads-footer-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 25vh;
    /* Max height instead of fixed */
    background: transparent;
    /* No background - banner only */
    z-index: 9999;
    transform: translateY(100%);
    /* Hidden by default */
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.fads-footer-popup.show {
    transform: translateY(0);
    /* Slide up */
}

/* Enable pointer events for child elements */
.fads-footer-popup.show .fads-close-btn,
.fads-footer-popup.show .fads-popup-link {
    pointer-events: auto;
}

/* Close Button (Top-Left) */
.fads-close-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fads-close-btn:hover {
    background: white;
    transform: scale(1.1);
}

.fads-close-btn svg {
    color: #0A1628;
    width: 16px;
    height: 16px;
}

/* Ad Link & Image */
.fads-popup-link {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.fads-popup-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Show full image, no cropping */
    object-position: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .fads-footer-popup {
        max-height: 30vh;
        /* More space on mobile */
        padding: 8px;
    }

    .fads-close-btn {
        width: 28px;
        height: 28px;
        top: 4px;
        left: 4px;
    }

    .fads-close-btn svg {
        width: 14px;
        height: 14px;
    }

    .fads-popup-image {
        max-width: calc(100% - 40px);
        /* Leave space for close button */
        border-radius: 4px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .fads-footer-popup {
        max-height: 35vh;
    }
}

/* Ensure content doesn't hide behind popup when visible */
body.fads-popup-active {
    padding-bottom: 20vh;
}

@media (max-width: 768px) {
    body.fads-popup-active {
        padding-bottom: 25vh;
    }
}

/* OLD MODAL STYLES - REMOVE */
/* Deprecated: Modal-style popup removed */
.fads-popup,
.popup-overlay,
.popup-content,
.popup-close {
    display: none !important;
}

/* ==================== VIDEO WIDGET (STICKY) ==================== */
.fads-video-widget {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 40px);
    z-index: 9998;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    background: #000;
    transform: translateY(400px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.fads-video-widget.show {
    transform: translateY(0);
    opacity: 1;
}

/* Position Variants */
.fads-video-bottom-right {
    bottom: 20px;
    right: 20px;
}

.fads-video-bottom-left {
    bottom: 20px;
    left: 20px;
}

.widget-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
}

.widget-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Video Container */
.video-widget-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

/* Video Poster */
.video-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.video-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-poster-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* Play Button */
.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 5;
}

.video-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Iframe */
.video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Click Overlay (invisible) */
.video-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.01);
    z-index: 5;
    cursor: pointer;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .fads-video-widget {
        width: calc(100% - 40px);
        max-width: 320px;
    }

    .fads-video-bottom-right,
    .fads-video-bottom-left {
        right: 20px;
        left: 20px;
    }

    .widget-close {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .fads-video-widget {
        bottom: 12px;
    }
}

/* ==================== LOADING STATES ==================== */
.fads-content-ad img,
.popup-content img,
.fads-video-widget img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

.fads-content-ad img[src],
.popup-content img[src],
.fads-video-widget img[src] {
    animation: none;
    background: none;
}

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

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

/* ==================== ACCESSIBILITY ==================== */
.fads-popup:focus-within,
.fads-video-widget:focus-within {
    outline: 3px solid #D4AF37;
    outline-offset: 2px;
}

.popup-close:focus,
.widget-close:focus {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

/* ==================== PRINT STYLES ==================== */
@media print {

    .fads-content-ad,
    .fads-popup,
    .fads-video-widget {
        display: none !important;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {

    .fads-content-ad a,
    .popup-close,
    .widget-close,
    .fads-video-widget {
        transition: none !important;
        animation: none !important;
    }

    .popup-overlay {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}