/* ===========================================
   BLOG STYLES - Taxgoat
   Unified Sidebar Design (matching Calculators)
   =========================================== */

/* ===== BLOG PAGE LAYOUT ===== */
.blog-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.blog-page .navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ===== BLOG CONTAINER - Calculator Style ===== */
.blog-container {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 65px);
    padding-top: 65px; /* Space for fixed header */
}

/* ===== SIDEBAR - Fixed Left (Calculator Style) ===== */
.blog-sidebar {
    position: fixed;
    top: 65px; /* Directly below fixed navbar */
    left: 0;
    width: 280px;
    height: calc(100vh - 65px);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 100; /* Below header (1000), above content */
    padding: 1.5rem 0;
    transition: transform var(--transition-normal);
}

.sidebar-section {
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-body);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Filter Buttons - Category Style */
.filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-btn:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-btn {
    padding: 0.4rem 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tag-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* Sidebar CTA */
.sidebar-cta {
    margin: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, white 100%);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    text-align: center;
}

.sidebar-cta .cta-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-cta h4 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.sidebar-cta p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.sidebar-cta .btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.sidebar-cta .btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT AREA ===== */
.blog-articles {
    flex: 1;
    margin-left: 280px; /* Space for fixed sidebar */
    padding: 2rem 3rem;
    background: var(--bg-body);
    min-height: calc(100vh - 65px);
}

/* Blog Header (Inside Main Area) - Explicit styling to override cache */
.blog-header {
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a2744 100%);
    border-radius: var(--radius-lg);
    text-align: center;
}

.blog-header h1 {
    font-size: 2rem;
    color: white !important;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.blog-header p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 600px;
    margin: 0 auto;
}

/* Articles Header */
.articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.articles-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.articles-sort select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.articles-sort select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    min-height: 400px;
}

/* ===== POST CARD ===== */
.post-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-normal);
}

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

.post-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-image {
    position: relative;
    height: 180px;
    background: var(--bg-body);
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 3rem;
    opacity: 0.3;
}

.pro-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, var(--secondary) 0%, #4F46E5 100%);
    border-radius: var(--radius-full);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

.post-content {
    padding: 1.25rem;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}

.post-category {
    color: var(--primary-dark);
    font-weight: 500;
}

.post-date {
    color: var(--text-light);
}

.post-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.post-tags {
    display: flex;
    gap: 0.5rem;
}

.mini-tag {
    font-size: 0.7rem;
    color: var(--primary);
    opacity: 0.7;
}

/* Locked Post */
.post-locked {
    opacity: 0.85;
}

.post-locked .post-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(99, 102, 241, 0.2) 100%);
}

/* ===== STATES ===== */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.empty-icon,
.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    grid-column: 1 / -1;
}

.load-more-container .btn {
    padding: 0.875rem 2rem;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.load-more-container .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== MOBILE SIDEBAR TOGGLE ===== */
.sidebar-toggle-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ===== FOOTER ===== */
.blog-page .footer,
.blog-page ~ #footer-container footer,
.blog-container ~ #footer-container footer {
    margin-left: 280px; /* Space for fixed sidebar */
    background: var(--bg-dark);
    padding: 2rem;
    color: var(--text-inverse);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.footer-brand .logo-icon {
    width: 24px;
    height: 24px;
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-light);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

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

.footer-bottom {
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== ARTICLE PAGE ===== */
.article-container {
    margin-left: 280px; /* Space for fixed sidebar */
    max-width: 900px;
    padding: 2rem 3rem 4rem;
}

.article-header {
    margin-bottom: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--primary);
}

.article-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.article-category {
    color: var(--primary-dark);
    font-weight: 500;
}

.article-date,
.article-reading-time {
    color: var(--text-muted);
}

.article-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.article-excerpt {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-tag {
    padding: 0.4rem 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--primary);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.article-tag:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* Cover Image */
.article-cover {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.article-cover img {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
}

/* Article Body - Prose Styling */
.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-main);
}

.article-body.content-faded {
    position: relative;
    max-height: 400px;
    overflow: hidden;
}

.article-body.content-faded::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, transparent, var(--bg-body));
    pointer-events: none;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    margin: 2rem 0 1rem;
    color: var(--text-main);
}

.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }

.prose p {
    margin-bottom: 1.5rem;
}

.prose ul,
.prose ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose a {
    color: var(--primary);
    text-decoration: underline;
}

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

.prose img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
}

.prose blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--primary);
    background: var(--bg-white);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-style: italic;
    color: var(--text-muted);
}

.prose code {
    background: var(--bg-body);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.prose pre {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
}

.prose pre code {
    background: transparent;
    padding: 0;
}

/* Pro Paywall */
.pro-paywall {
    margin-top: -50px;
    position: relative;
    z-index: 10;
}

.paywall-content {
    background: var(--bg-white);
    border: 2px solid var(--secondary);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.paywall-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.paywall-content h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.paywall-content > p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.paywall-benefits {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
    text-align: left;
}

.paywall-benefits .benefit {
    font-size: 0.9rem;
    color: var(--primary);
}

.paywall-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 300px;
    margin: 0 auto;
}

.paywall-actions .btn {
    display: block;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: var(--transition-fast);
}

.paywall-actions .btn-primary {
    background: var(--primary);
    color: white;
}

.paywall-actions .btn-primary:hover {
    background: var(--primary-hover);
}

.paywall-actions .btn-secondary {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
}

.paywall-actions .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Article Footer */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.share-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.share-section span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition-fast);
}

.share-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Related Articles */
.related-articles {
    margin-left: 280px; /* Space for fixed sidebar */
    padding: 0 3rem 4rem;
}

.related-articles h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.related-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

.related-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.related-image {
    position: relative;
    height: 120px;
    background: var(--bg-body);
}

.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2rem;
    opacity: 0.3;
}

.pro-badge-small {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.2rem 0.5rem;
    background: var(--secondary);
    border-radius: 4px;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
}

.related-content {
    padding: 1rem;
}

.related-content h4 {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .blog-sidebar {
        width: 260px;
    }
    
    .blog-articles,
    .article-container,
    .related-articles,
    .blog-page .footer,
    .blog-page ~ #footer-container footer,
    .blog-container ~ #footer-container footer {
        margin-left: 260px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 768px) {
    .blog-sidebar {
        transform: translateX(-100%);
        width: 280px;
        top: 0;
        height: 100vh;
        padding-top: 70px;
    }
    
    .blog-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .blog-articles,
    .article-container,
    .related-articles,
    .blog-page .footer,
    .blog-page ~ #footer-container footer,
    .blog-container ~ #footer-container footer {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .blog-header h1 {
        font-size: 1.5rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-title {
        font-size: 1.75rem;
    }
    
    .article-excerpt {
        font-size: 1rem;
    }
    
    .article-body {
        font-size: 1rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .paywall-benefits {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .articles-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .post-image {
        height: 150px;
    }
    
    .article-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ===== ARTICLE PAGE SPECIFIC ===== */
.article-page .blog-articles {
    background: var(--bg-white);
}

.related-articles-inline {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-articles-inline h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.related-articles-inline .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* TOC Link */
.toc-link {
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
}

.toc-link:hover {
    color: var(--primary) !important;
}

/* ===== PRINT STYLES ===== */
@media print {
    .blog-sidebar,
    .sidebar-toggle-btn,
    .navbar,
    .blog-page .footer {
        display: none !important;
    }
    
    .blog-articles,
    .article-container,
    .related-articles {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
