/* ═══════════════════════════════════════════════════════════
   TrendsXtra - Public Site Styles
   Premium dark theme with glassmorphism and modern aesthetics
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─────────────────────────────── */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.6);
    --bg-card-hover: rgba(30, 30, 55, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-strong: rgba(255, 255, 255, 0.06);

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a82;
    --text-link: #7c6cf0;

    --accent-primary: #7c6cf0;
    --accent-secondary: #6c5ce7;
    --accent-gradient: linear-gradient(135deg, #7c6cf0 0%, #c56cf0 100%);
    --accent-gradient-2: linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #ec4899 100%);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(124, 108, 240, 0.3);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(124, 108, 240, 0.15);

    /* Category colors */
    --cat-fix-errors: #ef4444;
    --cat-comparisons: #f59e0b;
    --cat-best-of: #10b981;
    --cat-safe-or-not: #f97316;
    --cat-ai-tools: #8b5cf6;
    --cat-trending: #06b6d4;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-primary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ─── Container ─────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 820px;
}

/* ─── Button ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* ─── Navbar ────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 0;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.brand-icon {
    font-size: 24px;
}

.brand-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ─── Hero Section ──────────────────────────────────────── */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 108, 240, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--accent-gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── Category Pills ───────────────────────────────────── */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
    justify-content: center;
}

.pill {
    padding: 8px 18px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.pill:hover, .pill.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

/* ─── Posts Grid ────────────────────────────────────────── */
.posts-section {
    padding: 40px 0 80px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* ─── Post Card ─────────────────────────────────────────── */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.35s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.post-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    background: var(--bg-card-hover);
}

.post-card-header {
    padding: 20px 24px 0;
}

.category-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-fix-errors { background: rgba(239, 68, 68, 0.15); color: var(--cat-fix-errors); }
.cat-comparisons { background: rgba(245, 158, 11, 0.15); color: var(--cat-comparisons); }
.cat-best-of { background: rgba(16, 185, 129, 0.15); color: var(--cat-best-of); }
.cat-safe-or-not { background: rgba(249, 115, 22, 0.15); color: var(--cat-safe-or-not); }
.cat-ai-tools { background: rgba(139, 92, 246, 0.15); color: var(--cat-ai-tools); }
.cat-trending { background: rgba(6, 182, 212, 0.15); color: var(--cat-trending); }

.post-card-body {
    padding: 16px 24px;
    flex: 1;
}

.post-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}

.post-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-card-title a:hover {
    color: var(--accent-primary);
}

.post-card-excerpt {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.post-card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Category Hero ─────────────────────────────────────── */
.category-hero {
    padding: 60px 0 40px;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.category-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.category-desc {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ─── Article Page ──────────────────────────────────────── */
.article {
    padding: 40px 0 80px;
}

.article-header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.article-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.3;
    margin: 16px 0;
    letter-spacing: -0.02em;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: var(--text-muted);
    font-size: 14px;
    flex-wrap: wrap;
}

/* Intro */
.article-intro {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-glass);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Quick Answer Box */
.quick-answer-box {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(124, 108, 240, 0.08) 0%, rgba(197, 108, 240, 0.05) 100%);
    border: 1px solid rgba(124, 108, 240, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 40px;
}

.quick-answer-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.quick-answer-content strong {
    color: var(--accent-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-answer-content p {
    margin-top: 6px;
    color: var(--text-primary);
    line-height: 1.7;
}

/* Table of Contents */
.toc-box {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 40px;
}

.toc-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.toc-list {
    list-style: none;
    counter-reset: toc;
    padding: 0;
}

.toc-list li {
    counter-increment: toc;
    margin: 6px 0;
}

.toc-list li::before {
    content: counter(toc) ". ";
    color: var(--accent-primary);
    font-weight: 600;
}

.toc-list a {
    color: var(--text-secondary);
    font-size: 15px;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: var(--accent-primary);
}

/* Article Sections */
.article-section {
    margin-bottom: 40px;
}

.article-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.section-content {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 16px;
}

/* Key List */
.key-list {
    list-style: none;
    padding: 0;
}

.key-list li {
    position: relative;
    padding: 12px 16px 12px 40px;
    margin-bottom: 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.key-list li:hover {
    border-color: var(--border-hover);
    background: var(--bg-glass-strong);
}

.key-list li::before {
    content: '✓';
    position: absolute;
    left: 14px;
    color: var(--accent-primary);
    font-weight: 700;
}

/* FAQ Section */
.faq-section {
    margin-bottom: 40px;
}

.faq-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--border-hover);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 18px 20px;
    background: var(--bg-glass);
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: var(--bg-glass-strong);
}

.faq-toggle {
    font-size: 20px;
    font-weight: 300;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.faq-item.open .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
    padding: 0 20px 18px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* CTA Box */
.cta-box {
    text-align: center;
    padding: 40px 32px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    margin-top: 48px;
}

.cta-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.cta-desc {
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.cta-actions {
    margin-top: 28px;
}

.btn-cta {
    background: #fff;
    color: var(--accent-primary);
    border: none;
    padding: 14px 32px;
    font-weight: 700;
    font-size: 16px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn-cta:hover {
    background: var(--bg-primary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.btn-arrow {
    margin-left: 8px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.btn-cta:hover .btn-arrow {
    transform: translateX(5px);
}

/* ─── Empty State (Public) ──────────────────────────────── */
.empty-state-public {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-public h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state-public p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ─── Footer ────────────────────────────────────────────── */
.site-content {
    flex: 1;
}

.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .brand-icon {
    font-size: 28px;
}

.footer-brand .brand-text {
    font-size: 22px;
    font-weight: 700;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.6;
}

.footer-links h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── Ads Styling ────────────────────────────────────────── */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    width: 100%;
    overflow: hidden;
    text-align: center;
}

.ad-unit {
    display: inline-block;
    max-width: 100%;
    min-height: 50px;
}

/* Sticky Bottom Ad */
.ad-sticky-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 10px 0;
    display: none; /* Shown via JS or CSS on mobile */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.ad-sticky-bottom.visible {
    display: flex;
}

.ad-close {
    position: absolute;
    top: -30px;
    right: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 1001;
}

/* Specific Sizes placeholders to prevent CLS */
.ad-728x90 { min-height: 90px; }
.ad-468x60 { min-height: 60px; }
.ad-300x250 { min-height: 250px; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.open {
        display: flex;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .article-meta {
        flex-direction: column;
        gap: 8px;
    }

    .quick-answer-box {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 50px 0 40px;
    }

    .category-pills {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }

    .category-pills::-webkit-scrollbar {
        display: none;
    }
}
