/* ============================================
   Single Post UI Improvements - Styles
   ============================================ */

/* Reading Time Badge */
.spui-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.spui-reading-time svg {
    width: 14px;
    height: 14px;
}


/* ============================================
   Floating Social Share Buttons
   ============================================ */

.spui-social-floating {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spui-social-floating a {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.spui-social-floating a:hover {
    transform: scale(1.15) translateX(5px);
}

.spui-share-twitter { background: #1da1f2; }
.spui-share-facebook { background: #1877f2; }
.spui-share-linkedin { background: #0077b5; }
.spui-share-reddit { background: #ff4500; }
.spui-share-copy { background: #333; cursor: pointer; }

@media (max-width: 1200px) {
    .spui-social-floating {
        position: static;
        flex-direction: row;
        justify-content: center;
        margin: 25px 0;
        transform: none;
    }
    
    .spui-social-floating a:hover {
        transform: scale(1.1);
    }
}


/* ============================================
   Author Bio Box
   ============================================ */

.spui-author-bio {
    margin: 40px 0;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border-left: 4px solid #667eea;
}

.spui-author-bio-inner {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.spui-author-bio-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.spui-author-bio-content { flex: 1; }

.spui-author-bio-name {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
}

.spui-author-bio-name a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.spui-author-bio-name a:hover {
    color: #667eea;
}

.spui-author-bio-text {
    margin: 0 0 12px 0;
    color: #555;
    line-height: 1.7;
}

.spui-author-bio-link {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.spui-author-bio-link:hover {
    color: #764ba2;
    transform: translateX(4px);
    display: inline-block;
}

@media (max-width: 600px) {
    .spui-author-bio-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .spui-author-bio {
        padding: 20px;
    }
}


/* ============================================
   Enhanced Download Form
   ============================================ */

.spui-download-form {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 35px;
    margin: 35px 0;
    color: white;
}

.spui-download-form h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-align: center;
}

.spui-download-input {
    display: flex;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 20px;
}

.spui-download-input input[type="text"] {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.spui-download-input button {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    background: #1a1a1a;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.spui-download-input button:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.spui-quality-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.spui-quality-btn {
    padding: 10px 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.spui-quality-btn:hover,
.spui-quality-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

.spui-download-status {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    opacity: 0.9;
}

@media (max-width: 600px) {
    .spui-download-input {
        flex-direction: column;
    }
    
    .spui-download-form {
        padding: 25px;
    }
}


/* ============================================
   Enhanced Featured Image
   ============================================ */

.spui-featured-image {
    margin-bottom: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.spui-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}


/* ============================================
   Enhanced Post Meta
   ============================================ */

.spui-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.spui-post-meta > * {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 14px;
}

.spui-post-meta a {
    color: #667eea;
    text-decoration: none;
}

.spui-post-meta a:hover {
    text-decoration: underline;
}


/* ============================================
   Lightweight Interstitial Ad
   ============================================ */

.spui-interstitial {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spui-interstitial.spui-active {
    opacity: 1;
    visibility: visible;
}

.spui-interstitial-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 40px 50px;
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.spui-interstitial.spui-active .spui-interstitial-content {
    transform: scale(1);
}

.spui-interstitial h2 {
    margin: 0 0 15px 0;
    font-size: 26px;
    font-weight: 700;
}

.spui-interstitial p {
    margin: 0 0 25px 0;
    font-size: 15px;
    opacity: 0.9;
    line-height: 1.6;
}

.spui-interstitial-close {
    display: inline-block;
    padding: 12px 30px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.spui-interstitial-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.spui-interstitial-ad {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.spui-interstitial-ad-placeholder {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0.7;
}


/* ============================================
   Downloader Ad Placements
   ============================================ */

.spui-ad-container {
    min-height: 60px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.spui-ad-container::before {
    content: 'Advertisement';
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spui-ad-placeholder {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 13px;
    transition: opacity 0.3s ease;
}

.spui-ad-container.spui-ad-loaded .spui-ad-placeholder {
    display: none;
}

.spui-ad-container.spui-ad-loaded::before {
    display: none;
}

.spui-ad-loaded {
    background: transparent;
}

.spui-ad-loaded::before {
    display: none;
}


/* Hero Banner - Below Download Input */
.spui-hero-ad {
    margin: 20px 0;
    min-height: 90px;
}

.spui-hero-ad .spui-ad-placeholder {
    height: 90px;
}

@media (min-width: 728px) {
    .spui-hero-ad .spui-ad-placeholder {
        width: 728px;
        max-width: 100%;
    }
}


/* In-Feed Ad - Between Format Options */
.spui-infeed-ad {
    margin: 15px 0;
    padding: 15px 0;
    border-top: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
}

.spui-infeed-ad .spui-ad-placeholder {
    height: 250px;
    flex-direction: column;
    gap: 8px;
}

.spui-infeed-ad .spui-ad-placeholder::after {
    content: 'Native Ad';
    font-size: 11px;
    color: #999;
}


/* ============================================
   Mobile-Optimized Ad Placements
   ============================================ */

@media (max-width: 767px) {
    /* Hide non-essential ads on mobile - show only sticky */
    .spui-hero-ad,
    .spui-infeed-ad {
        display: none;
    }
    
    /* Only show hero on desktop */
    .spui-hero-ad {
        display: block;
    }
}

@media (min-width: 768px) {
    /* Hide sticky banner on desktop */
    .spui-sticky-banner {
        display: none !important;
    }
    
    /* Show in-feed on desktop only */
    .spui-infeed-ad {
        display: block;
    }
}


/* Sticky Bottom Mobile Banner */
.spui-sticky-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90px;
}

.spui-sticky-banner.spui-active {
    transform: translateY(0);
}

.spui-sticky-banner-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-height: 70px;
}

.spui-sticky-banner .spui-ad-placeholder {
    width: 320px;
    max-width: 100%;
    height: 70px;
    background: #f0f0f0;
}

.spui-sticky-banner-close {
    position: absolute;
    top: -10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #333;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

@media (min-width: 768px) {
    .spui-sticky-banner {
        display: none;
    }
}


/* ============================================
   Recommended Tools - Native Ad Style
   ============================================ */

.spui-recommended-tools {
    margin: 30px 0;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #eee;
}

.spui-recommended-tools-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spui-recommended-tools-title svg {
    width: 18px;
    height: 18px;
    color: #667eea;
}

.spui-recommended-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 600px) {
    .spui-recommended-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.spui-recommended-card {
    background: white;
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.spui-recommended-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.spui-recommended-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.spui-recommended-card:hover .spui-recommended-icon {
    transform: scale(1.1);
}

.spui-recommended-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.spui-recommended-desc {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

.spui-recommended-label {
    display: none;
}

.spui-recommended-tools[aria-label="sponsored"] .spui-recommended-label {
    display: block;
    font-size: 10px;
    color: #999;
    text-align: center;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Hide ads during form interaction */
.spui-form-active .spui-ad-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.spui-download-form-wrapper {
    position: relative;
    z-index: 10;
}

.spui-download-form,
.spui-quality-options,
.spui-download-input button {
    position: relative;
    z-index: 11;
}


/* Ad load performance monitoring */
.spui-ad-loading {
    position: relative;
}

.spui-ad-loaded-success {
    animation: spuiAdFadeIn 0.3s ease;
}

@keyframes spuiAdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* Broken ad slot removal */
.spui-ad-broken {
    display: none !important;
}

.spui-ad-timeout {
    opacity: 0.5;
}
