/**
 * AI Marketing Paywall - Blur Effects CSS
 * Version: 2.2.0
 * Description: Advanced blur and fade effects for premium content protection
 */

/* Full Blur Effect */
.aimarketing-blur-full {
    filter: blur(12px);
    -webkit-filter: blur(12px);
    -moz-filter: blur(12px);
    -ms-filter: blur(12px);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    position: relative;
}

.aimarketing-blur-full::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

/* Partial Blur Effect (Fade-out at 50%) */
.aimarketing-blur-partial {
    position: relative;
    min-height: 200px;
}

.aimarketing-blur-partial::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(255, 255, 255, 0.5) 30%,
        rgba(255, 255, 255, 0.95) 100%
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    -moz-backdrop-filter: blur(8px);
    pointer-events: none;
}

/* Dark theme support */
body.dark-mode .aimarketing-blur-partial::after,
body[data-theme="dark"] .aimarketing-blur-partial::after {
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(0, 0, 0, 0.5) 30%,
        rgba(0, 0, 0, 0.95) 100%
    );
}

/* Teaser (No Blur) */
.aimarketing-teaser {
    opacity: 0.9;
    position: relative;
}

/* ========================================
   Category Protection - Theme Cards/Archives
   Uses post_class() injected classes:
   - aimarketing-category-protected
   - aimarketing-category-blur-{light|medium|heavy|full}
   ======================================== */

.aimarketing-category-protected {
    position: relative;
}

/* DISABLED: Premium badge overlay removed - using blur system only
.aimarketing-category-protected::after {
    content: '🔒 Premium Sadržaj';
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}
*/

/* Apply blur only to typical theme card elements, not the overlay */
.aimarketing-category-protected .post-featured-image,
.aimarketing-category-protected .post-img-wrap,
.aimarketing-category-protected .entry-header,
.aimarketing-category-protected .entry-title,
.aimarketing-category-protected .entry-content,
.aimarketing-category-protected .entry-meta,
.aimarketing-category-protected .cat-links {
    user-select: none;
    -webkit-user-select: none;
}

.aimarketing-category-blur-light .post-featured-image,
.aimarketing-category-blur-light .post-img-wrap,
.aimarketing-category-blur-light .entry-header,
.aimarketing-category-blur-light .entry-title,
.aimarketing-category-blur-light .entry-content,
.aimarketing-category-blur-light .entry-meta,
.aimarketing-category-blur-light .cat-links {
    filter: blur(2px);
    opacity: 0.75;
}

.aimarketing-category-blur-medium .post-featured-image,
.aimarketing-category-blur-medium .post-img-wrap,
.aimarketing-category-blur-medium .entry-header,
.aimarketing-category-blur-medium .entry-title,
.aimarketing-category-blur-medium .entry-content,
.aimarketing-category-blur-medium .entry-meta,
.aimarketing-category-blur-medium .cat-links {
    filter: blur(5px);
    opacity: 0.6;
}

.aimarketing-category-blur-heavy .post-featured-image,
.aimarketing-category-blur-heavy .post-img-wrap,
.aimarketing-category-blur-heavy .entry-header,
.aimarketing-category-blur-heavy .entry-title,
.aimarketing-category-blur-heavy .entry-content,
.aimarketing-category-blur-heavy .entry-meta,
.aimarketing-category-blur-heavy .cat-links {
    filter: blur(10px);
    opacity: 0.45;
}

.aimarketing-category-blur-full .post-featured-image,
.aimarketing-category-blur-full .post-img-wrap,
.aimarketing-category-blur-full .entry-header,
.aimarketing-category-blur-full .entry-title,
.aimarketing-category-blur-full .entry-content,
.aimarketing-category-blur-full .entry-meta,
.aimarketing-category-blur-full .cat-links {
    filter: blur(15px);
    opacity: 0.35;
}

.aimarketing-teaser::after {
    content: '...';
    font-size: 2rem;
    color: #667eea;
    font-weight: bold;
}

/* Luxury Paywall Card */
.aimarketing-paywall-luxury {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3rem 2rem;
    border-radius: 16px;
    margin: 2rem 0;
    color: white;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease;
}

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

.aimarketing-paywall-luxury::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 10s infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: translate(0, 0) scale(1); 
    }
    50% { 
        transform: translate(20px, 20px) scale(1.1); 
    }
}

/* CTA Button */
.aimarketing-cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50px;
    color: white !important;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 1.5rem;
    cursor: pointer;
}

.aimarketing-cta-button:hover {
    background: white;
    color: #667eea !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .aimarketing-paywall-luxury {
        padding: 2rem 1.5rem;
    }
    
    .aimarketing-cta-button {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
}

/* Loading Animation */
.aimarketing-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Preview Blurred Section (for percentage/paragraph preview)
   Applied to content after visible preview section
   ======================================== */

.aimarketing-preview-visible {
    position: relative;
    z-index: 2;
}

.aimarketing-preview-blurred {
    position: relative;
    z-index: 1;
    /* Inline blur style from PHP will be applied here */
    overflow: hidden;
}

/* Ensure blur is visible and applies to all children */
.aimarketing-preview-blurred * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: none !important;
}

/* Add overlay for better visual effect */
.aimarketing-preview-blurred::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.7) 100%
    );
    pointer-events: none;
    z-index: 10;
}

/* Dark theme support for blurred overlay */
body.dark-mode .aimarketing-preview-blurred::before,
body[data-theme="dark"] .aimarketing-preview-blurred::before {
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(0, 0, 0, 0.3) 20%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

/* ========================================
   Paywall Overlay (positioned above blurred content)
   ======================================== */

.aimarketing-paywall-wrapper {
    position: relative;
    isolation: isolate; /* Create new stacking context */
}

.aimarketing-paywall-overlay {
    position: absolute;
    z-index: 999 !important;
    pointer-events: auto; /* Enable clicks on paywall card */
}

/* Flying card overlay for locked category listings */
.aimarketing-fly-card-container {
    position: relative;
    isolation: isolate;
}

.aimarketing-fly-card-locked {
    filter: blur(6px);
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s ease;
}

.aimarketing-fly-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    pointer-events: auto;
    background: radial-gradient(circle at 50% 50%, rgba(20,20,35,0.5) 0%, rgba(10,10,20,0.75) 45%, rgba(0,0,0,0.85) 100%);
}

.aimarketing-fly-card {
    max-width: 320px;
    width: 90%;
    padding: 18px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #e5e7eb;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    position: relative;
    overflow: hidden;
    animation: aimarketing-fly 6s ease-in-out infinite;
    text-align: center;
}

.aimarketing-fly-card::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 160%;
    height: 160%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    animation: aimarketing-fly-light 8s linear infinite;
}

.aimarketing-fly-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #8b5cf6;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.aimarketing-fly-card h4 {
    margin: 12px 0 6px;
    font-size: 18px;
    font-weight: 800;
    color: #f9fafb;
    position: relative;
    z-index: 1;
}

.aimarketing-fly-card p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.4;
    color: #d1d5db;
    position: relative;
    z-index: 1;
}

.aimarketing-fly-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

@keyframes aimarketing-fly {
    0% { transform: translateY(0px) rotate(-0.3deg); }
    50% { transform: translateY(-6px) rotate(0.6deg); }
    100% { transform: translateY(0px) rotate(-0.3deg); }
}

@keyframes aimarketing-fly-light {
    0% { transform: translate(-10%, -10%) rotate(0deg); }
    100% { transform: translate(20%, 20%) rotate(360deg); }
}

/* Ensure preview visible content has high z-index */
.aimarketing-preview-visible {
    position: relative;
    z-index: 10 !important;
}

/* ========================================
   Paywall Card Blur Exemption
   Prevent paywall elements from being blurred in category protection
   ======================================== */

/* Exempt PayPal container and payment elements from category blur */
.aimarketing-category-protected #aim-paypal-container,
.aimarketing-category-protected #aim-card-container,
.aimarketing-category-protected #aim-crypto-container,
.aimarketing-category-protected .aimarketing-paywall,
.aimarketing-category-protected .aimarketing-paywall-overlay,
.aimarketing-category-protected .aimarketing-paywall-wrapper,
.aimarketing-category-protected .aimarketing-paywall-luxury,
.aimarketing-category-protected [class*="aimarketing-paywall"],
.aimarketing-category-protected [id*="aim-paypal"],
.aimarketing-category-protected [id*="aim-card"],
.aimarketing-category-protected [id*="aim-crypto"] {
    filter: none !important;
    opacity: 1 !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 1000 !important;
}

/* Ensure paywall buttons and interactive elements are fully functional */
.aimarketing-category-protected #aim-paypal-container *,
.aimarketing-category-protected #aim-card-container *,
.aimarketing-category-protected #aim-crypto-container *,
.aimarketing-category-protected .aimarketing-paywall *,
.aimarketing-category-protected .aimarketing-paywall-luxury * {
    filter: none !important;
    opacity: 1 !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    pointer-events: auto !important;
}

/* High priority override for PayPal SDK elements */
.aimarketing-category-protected .paypal-buttons,
.aimarketing-category-protected .paypal-button,
.aimarketing-category-protected [data-funding-source],
.aimarketing-category-protected iframe[src*="paypal"] {
    filter: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1001 !important;
}
