/**
 * Viral UI/UX Upgrades - Event Invitation Generator
 * Prompt 1A: Hero Section, 1B: Gallery Grid, 1C: Preview Enhancement
 */

/* ==================== PROMPT 1A: VIRAL HERO SECTION ==================== */
.viral-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.viral-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.viral-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.viral-headline {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    line-height: 1.1;
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
    background: none;
    -webkit-text-fill-color: white;
}

.viral-subheadline {
    font-size: 1.25rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Social Proof Counter */
.social-proof-counter {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.counter-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    font-variant-numeric: tabular-nums;
}

.counter-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Trending Section */
.trending-section {
    margin-bottom: 2rem;
}

.trending-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 107, 107, 0.8); }
}

.trending-thumbnails {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.trending-thumb {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.trending-thumb:hover {
    transform: translateY(-8px) scale(1.05);
}

.thumb-preview {
    width: 120px;
    height: 160px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 3px solid rgba(255,255,255,0.3);
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trending-thumb:hover .thumb-overlay {
    opacity: 1;
}

.thumb-overlay span {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: var(--primary-gradient);
    border-radius: 20px;
}

.thumb-name {
    display: block;
    color: rgba(255,255,255,0.9);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    text-align: center;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Quick Start Buttons */
.quick-start-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.quick-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.quick-btn-prank {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.quick-btn-real {
    background: white;
    color: #667eea;
}

.quick-btn-fun {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    color: #764ba2;
}

.quick-icon {
    font-size: 1.5rem;
}

/* ==================== PROMPT 1B: VIRAL TEMPLATE GALLERY ==================== */
.viral-gallery {
    position: relative;
}

/* Filter Tabs */
.gallery-filter-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 30px;
    background: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-tab:hover {
    border-color: var(--primary-color);
}

.filter-tab.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.category-pill {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-light);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-pill:hover {
    background: white;
    border-color: var(--primary-color);
}

.category-pill.active {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

/* Masonry Grid */
.templates-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0;
    max-height: none;
    overflow: visible;
}

/* Masonry Card */
.masonry-card {
    position: relative;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.masonry-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.masonry-card.viral-card {
    border: 2px solid #ff6b6b;
}

/* Remix Badge */
.remix-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Masonry Preview - Text-based thumbnail */
.masonry-preview {
    position: relative;
    height: 200px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Simple hover effect - just zoom and shadow, no overlay */
.masonry-card:hover .masonry-preview {
    transform: scale(1.02);
}

/* Thumbnail content container */
.thumbnail-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 15px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* Thumbnail title - max 14px, 2 lines */
.thumbnail-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 12px;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

/* Thumbnail names - max 11px, 2 lines */
.thumbnail-names {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

/* Dark backgrounds get light text */
.masonry-preview.dark-bg .thumbnail-title,
.masonry-preview.dark-bg .thumbnail-names {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Light backgrounds get dark text */
.masonry-preview.light-bg .thumbnail-title,
.masonry-preview.light-bg .thumbnail-names {
    color: #1a1a2e;
    text-shadow: none;
}

/* Masonry Info */
.masonry-info {
    padding: 1rem;
}

.masonry-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.masonry-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.download-count {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.download-count svg {
    opacity: 0.7;
}

.use-this-btn {
    padding: 0.4rem 1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.use-this-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Load More Trigger */
.load-more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== PROMPT 1C: PREVIEW ENHANCEMENT ==================== */

/* Floating Share Button */
.floating-share-btn {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.floating-share-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.floating-share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

/* Download Watermarked Button */
.btn-outline-purple {
    background: transparent;
    border: 2px solid #764ba2;
    color: #764ba2;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.btn-outline-purple:hover {
    background: #764ba2;
    color: white;
}

.btn-medium {
    width: 100%;
}

/* Success Feedback */
.success-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    pointer-events: none;
}

.success-feedback.show {
    display: block;
}

.success-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: success-pop 0.5s ease;
}

@keyframes success-pop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.success-icon {
    font-size: 1.5rem;
}

.success-text {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

/* Typing Overlay */
.typing-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.typing-cursor {
    position: absolute;
    width: 2px;
    height: 20px;
    background: var(--primary-color);
    animation: blink 0.8s ease infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Instagram Story Frame */
.instagram-frame-container {
    position: relative;
    max-width: 360px;
    margin: 0 auto;
}

.instagram-frame {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.ig-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
}

.ig-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid white;
}

.ig-username {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

#instagramCanvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Compare Mockups Carousel */
.compare-mockups-carousel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.carousel-track {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 1rem;
    max-width: 100%;
}

.carousel-track > * {
    scroll-snap-align: center;
    flex: 0 0 auto;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.carousel-prev { left: 2rem; }
.carousel-next { right: 2rem; }

.close-carousel {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Share Preview Modal */
.share-modal-content {
    max-width: 480px;
}

.share-modal-desc {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
}

.copy-link-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-link-btn:hover {
    transform: scale(1.05);
}

/* Social Share Buttons */
.share-social-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.social-share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.social-share-btn:hover {
    transform: translateY(-2px);
}

.twitter-btn { background: #1da1f2; }
.facebook-btn { background: #1877f2; }
.whatsapp-btn { background: #25d366; }

.shares-remaining {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.shares-remaining span {
    font-weight: 700;
    color: var(--primary-color);
}

/* Preview Panel Position Fix */
.preview-panel {
    position: relative;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .viral-headline {
        font-size: 2rem;
    }

    .viral-subheadline {
        font-size: 1rem;
    }

    .counter-number {
        font-size: 1.75rem;
    }

    .trending-thumbnails {
        gap: 0.75rem;
    }

    .thumb-preview {
        width: 90px;
        height: 120px;
    }

    .quick-start-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-btn {
        justify-content: center;
    }

    .templates-masonry {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .masonry-preview {
        height: 160px;
    }

    .thumbnail-content {
        padding: 15px 10px;
    }

    .thumbnail-title {
        font-size: 11px;
        margin-bottom: 8px;
    }

    .thumbnail-names {
        font-size: 10px;
    }

    .floating-share-btn {
        top: auto;
        bottom: 20px;
        right: 20px;
    }

    .floating-share-btn span {
        display: none;
    }

    .share-social-buttons {
        flex-direction: column;
    }
}

/* Hide old tool-header when viral hero is present */
.viral-hero + .templates-gallery-section ~ .tool-workspace .tool-header,
.tool-container > .tool-header {
    display: none;
}

/* Lazy Load Image Placeholder */
.masonry-preview img[loading="lazy"] {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
}

/* ==================== MINIMAL HERO ==================== */
.viral-hero.viral-hero-minimal {
    padding: 2.5rem 2rem;
    margin-bottom: 1.5rem;
}

.viral-hero-minimal .viral-headline {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.viral-hero-minimal .viral-subheadline {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .viral-hero-minimal .viral-headline {
        font-size: 1.75rem;
    }
}

/* Remove the viral-card red border (was tied to remix badge) */
.masonry-card.viral-card {
    border: none;
}
