/**
 * Ad System Styles
 * Stiliai baneriams, reklamjuostoms ir popup'ams
 * 
 * @author Warp AI Agent
 * @date 2026-01-27
 */

/* ============================================
   BENDRI BANNER STILIAI
   ============================================ */

.ad-banner-container {
    display: block;
    margin: 0px auto;
    text-align: center;
    overflow: hidden;
}

.ad-strip-container {
    display: block;
    margin: 0 auto;
    text-align: center;
}

.ad-banner-link {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.2s ease-in-out;
}

.ad-banner-link:hover {
    opacity: 0.9;
}

.ad-banner-image,
.ad-strip-image,
.ad-popup-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: none;
}

/* ============================================
   REKLAMJUOSTOS (STRIPS)
   ============================================ */

.ad-strip-container {
    width: 100%;
    overflow: visible;
}

.ad-strip-top {
    position: sticky;
    top: var(--header-height);
    margin-top: 0;
    margin-bottom: 0;
    z-index: 100;
}

.ad-strip-bottom {
    position: sticky;
    bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    z-index: 100;
}

@media (min-width: 768px) {
    .ad-strip-top {
        top: var(--header-height);
    }
    
    .ad-strip-bottom {
        bottom: 0;
    }
}

.ad-strip-container .ad-banner-link {
    display: block;
}

.ad-strip-image {
    margin: 0 auto;
    max-height: 120px;
}

/* ============================================
   INLINE BANERIAI
   ============================================ */

.ad-banner-container[data-position-type="banner"] {
    padding: 0px;
    background: transparent;
    border-radius: 4px;
}

/* Skirtingi banner dydžiai */
/* 728x90 (leaderboard) */
.ad-banner-image[width="728"] {
    max-width: 728px;
}

/* 300x250 (medium rectangle) */
.ad-banner-image[width="300"] {
    max-width: 300px;
}

/* 300x600 (half page) */
.ad-banner-image[width="300"][height="600"] {
    max-width: 300px;
}

/* ============================================
   POPUP OVERLAY
   ============================================ */

.ad-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    backdrop-filter: blur(3px);
    overflow: auto;
}

.ad-popup-overlay[style*="opacity: 1"] {
    opacity: 1;
}

/* ============================================
   POPUP CONTENT
   ============================================ */

.ad-popup-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: fit-content;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    animation: popupSlideIn 0.3s ease-out;
    flex-shrink: 0;
    margin: auto;
    display: flex;
    flex-direction: column;
}

@keyframes popupSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.ad-popup-content .ad-banner-link {
    display: block;
}

.ad-popup-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */

.ad-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

.ad-close-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1) rotate(90deg);
}

.ad-close-button:active {
    transform: scale(0.95);
}

.ad-close-button:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    /* Strips */
    .ad-strip-container {
        padding: 0px 0;
    }
    
    .ad-strip-top {
        top: var(--header-height);
        z-index: 100;
        transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .ad-strip-top.menu-hidden {
        top: 0;
    }
    
    .ad-strip-bottom {
        bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom));
        z-index: 100;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .ad-strip-bottom.nav-hidden {
        bottom: 0;
    }
    
    .ad-strip-image {
        max-width: 100%;
        height: auto;
        max-height: 80px;
    }
    
    /* Inline banners */
    .ad-banner-container {
        padding: 0px;
        margin: 0px auto;
    }
    
    .ad-banner-image {
        max-width: 100%;
        height: auto;
    }
    
    /* Popups */
    .ad-popup-overlay {
        padding: 10px;
    }
    
    .ad-popup-content {
        max-width: 95vw;
        max-height: 85vh;
        border-radius: 6px;
        width: 100%;
    }
    
    .ad-close-button {
        width: 36px;
        height: 36px;
        font-size: 24px;
        top: 8px;
        right: 8px;
    }
}

@media (max-width: 480px) {
    .ad-strip-container {
        padding: 0px 0;
    }
    
    .ad-strip-image {
        max-height: 60px;
    }
    
    .ad-banner-container {
        margin: 0px auto;
    }
    
    .ad-close-button {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 5px;
        right: 5px;
    }
}

/* ============================================
   DARK MODE SUPPORT (optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .ad-strip-container {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .ad-popup-content {
        background: #1e1e1e;
    }
}

/* ============================================
   PRINT STYLES (hide ads when printing)
   ============================================ */

@media print {
    .ad-banner-container,
    .ad-strip-container,
    .ad-popup-overlay {
        display: none !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ad-close-button {
        background: black;
        border: 2px solid white;
    }
    
    .ad-popup-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ad-banner-link,
    .ad-close-button,
    .ad-popup-overlay {
        transition: none !important;
        animation: none !important;
    }
    
    @keyframes popupSlideIn {
        from, to {
            transform: none;
            opacity: 1;
        }
    }
}

/* ============================================
   LOADING STATE (optional)
   ============================================ */

.ad-banner-container.loading,
.ad-strip-container.loading {
    position: relative;
    min-height: 90px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* ============================================
   UTILITIES
   ============================================ */

/* Hide ads for users with ad blockers (graceful degradation) */
.no-ads .ad-banner-container,
.no-ads .ad-strip-container,
.no-ads .ad-popup-overlay {
    display: none;
}

/* Spacing utilities */
.ad-spacing-top {
    margin-top: 20px;
}

.ad-spacing-bottom {
    margin-bottom: 20px;
}

.ad-spacing-both {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* ============================================
   CAROUSEL / SLIDER
   ============================================ */

.ad-carousel-container {
    position: relative;
    margin: 0px auto;
    display: block;
    text-align: center;
    overflow: hidden;
    padding: 0px;
    background: transparent;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
}

.ad-carousel-wrapper {
    position: relative;
    width: 100%;
    display: inline-block;
}

.ad-carousel-track {
    position: relative;
    width: 100%;
    display: inline-block;
}

.ad-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: inline-block;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
}

.ad-carousel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
    position: relative;
}

.ad-carousel-slide .ad-banner-link {
    display: inline-block;
    text-decoration: none;
}

.ad-carousel-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: none;
}

/* ============================================
   CAROUSEL NAVIGATION ARROWS
   ============================================ */

.ad-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease-in-out;
    z-index: 100;
    opacity: 0.6;
}

.ad-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.ad-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.ad-carousel-arrow:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.ad-carousel-arrow svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.ad-carousel-arrow-prev {
    left: 3%;
}

.ad-carousel-arrow-next {
    right: 3%;
}

/* ============================================
   CAROUSEL DOT INDICATORS
   ============================================ */

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

.ad-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease-in-out;
    outline: none;
}

.ad-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.ad-carousel-dot.active {
    background: rgba(255, 255, 255, 1);
    width: 12px;
    height: 8px;
    border-radius: 4px;
}

.ad-carousel-dot:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================
   CAROUSEL RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .ad-carousel-arrow {
        width: 28px;
        height: 28px;
    }
    
    .ad-carousel-arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .ad-carousel-arrow-prev {
        left: 10%;
    }
    
    .ad-carousel-arrow-next {
        right: 10%;
    }
    
    .ad-carousel-dots {
        bottom: 6px;
        gap: 4px;
    }
    
    .ad-carousel-dot {
        width: 6px;
        height: 6px;
    }
    
    .ad-carousel-dot.active {
        width: 10px;
    }
}

@media (max-width: 480px) {
    .ad-carousel-arrow {
        width: 26px;
        height: 26px;
    }
    
    .ad-carousel-arrow svg {
        width: 14px;
        height: 14px;
    }
    
    .ad-carousel-arrow-prev {
        left: 8%;
    }
    
    .ad-carousel-arrow-next {
        right: 8%;
    }
    
    .ad-carousel-dots {
        bottom: 4px;
        gap: 3px;
    }
}

/* Pause carousel on hover (accessibility) */
.ad-carousel-container:hover .ad-carousel-track {
    animation-play-state: paused;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ad-carousel-arrow {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid white;
    }
    
    .ad-carousel-dot {
        border: 1px solid rgba(255, 255, 255, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ad-carousel-track,
    .ad-carousel-arrow,
    .ad-carousel-dot {
        transition: none !important;
    }
}
