/* Tajweed Blog Posts - Dedicated CSS File */
/* This file contains all styling for Tajweed-related blog posts */

/* Font fallbacks to prevent layout shifts */
body, html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-display: swap;
}

/* Standard blog styling with better spacing */
.blog-main-content {
    font-size: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 100vh; /* Reserve space to prevent layout shift */
    /* Less aggressive containment to prevent desktop layout issues */
    contain: layout;
    position: relative; /* Additional stability */
    /* Font stability */
    font-display: swap;
}

.blog-content-area {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh; /* Reserve space */
    contain: layout; /* Prevent layout shifts */
}

.blog-detail-header {
    padding-top: 20px !important; /* Reduced from 100px */
    /* Prevent font loading shifts */
    min-height: 150px; /* Reduced from 200px */
    contain: layout;
    /* Reserve space for dynamic header loading */
    position: relative;
}

/* Desktop-specific H1 spacing */
@media (min-width: 768px) {
    .blog-detail-header {
        padding-top: 40px !important; /* Increased spacing for desktop */
    }
}

/* Reserve space for header that loads dynamically */
body {
    padding-top: 60px; /* Reduced from 100px */
}

.blog-detail-header h1 {
    /* Reserve space for potential 3-line text */
    min-height: 4.5em;
    line-height: 1.5;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-display: swap;
    /* Prevent text reflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    /* Font fallback */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.blog-detail-meta {
    display: flex !important;
    justify-content: center !important;
    gap: 1.5rem !important;
    font-size: 0.95rem !important;
    color: #666 !important;
    margin-bottom: 2rem !important;
    flex-wrap: wrap !important;
}

.blog-detail-meta span {
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

.blog-detail-meta i {
    color: #1B5E20 !important;
    font-size: 0.9rem !important;
}

.blog-detail-header h1 {
    font-size: 2rem !important;
    margin-bottom: 1rem !important;
    padding: 1.5rem 2rem !important;
    text-align: center !important;
    color: #1B5E20 !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%) !important;
    border-radius: 15px !important;
    border: 2px solid #1B5E20 !important;
    box-shadow: 0 4px 15px rgba(27, 94, 32, 0.1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.blog-detail-header h1::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 3px !important;
    background: linear-gradient(90deg, #1B5E20 0%, #4caf50 50%, #1B5E20 100%) !important;
}

.blog-content-area h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: #1B5E20;
    font-weight: 700;
}

.blog-content-area h2#faqs {
    text-align: center !important;
}

.blog-content-area h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #0D47A1;
    font-weight: 600;
}

/* H3 with bullet points for better visual hierarchy */
.blog-content-area h3::before {
    content: "▶ ";
    color: #1B5E20;
    font-size: 0.9em;
    margin-right: 0.5rem;
}

.blog-content-area p {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.blog-content-area ul {
    padding-left: 2.5rem;
    margin-left: 0;
}

.blog-content-area ol {
    padding-left: 2.5rem;
    margin-left: 0;
}

.blog-content-area ul li,
.blog-content-area ol li {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

/* Table of Contents Styling */
.toc-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border: 2px solid #1B5E20;
    border-radius: 10px;
    padding: 1.2rem;
    margin: 1.5rem 0;
    position: relative;
    top: auto;
    box-shadow: 0 4px 15px rgba(27, 94, 32, 0.1);
    overflow: hidden;
}

.toc-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1B5E20 0%, #4caf50 50%, #1B5E20 100%);
}

.toc-container h3 {
    color: #1B5E20;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.toc-container ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.05rem;
}

.toc-container ul ul {
    margin-left: 1.5rem;
    margin-top: 0.3rem;
    gap: 0.1rem;
}

.toc-container li {
    margin: 0;
    padding: 0;
}

.toc-container a {
    color: #2e7d32;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: block;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
}

.toc-container a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    transition: left 0.5s ease;
}

.toc-container a:hover {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
    color: #1B5E20;
    border-left-color: #4caf50;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(27, 94, 32, 0.15);
}

.toc-container a:hover::before {
    left: 100%;
}

/* Enhanced styling for nested TOC items */
.toc-container ul ul a {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1B5E20;
    padding: 0.4rem 1rem;
    background: rgba(27, 94, 32, 0.1);
    border-left: 3px solid #4caf50;
}

.toc-container ul ul a:hover {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #0D47A1;
    border-left-color: #1B5E20;
    transform: translateX(5px);
}

/* Better spacing for sections */
.content-section {
    margin-bottom: 2.5rem;
}

/* Quick Answer / TL;DR Box */
.tldr-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e8 100%);
    border: 2px solid #1B5E20;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.1);
    position: relative;
    overflow: hidden;
}

.tldr-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1B5E20 0%, #4caf50 50%, #1B5E20 100%);
}

.tldr-box h3 {
    color: #1B5E20;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tldr-box h3 i {
    color: #4caf50;
    font-size: 1.4rem;
}

.tldr-box p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #2e7d32;
}

/* Quick Checklist Section */
.quick-checklist {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.quick-checklist h3 {
    color: #2e7d32;
    margin-top: 0;
    margin-bottom: 0.8rem;
}

.quick-checklist ul {
    margin: 0;
    padding-left: 1.2rem;
}

.quick-checklist li {
    margin-bottom: 0.3rem;
}

/* Path Maps / Learning Path Section */
.path-maps {
    background: #f0f8ff;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.path-maps h3 {
    color: #1976d2;
    margin-top: 0;
    margin-bottom: 0.8rem;
}

/* FAQ Section */
.blog-content-area .faq-section {
    background: #fff3e0 !important;
    border: 1px solid #ff9800 !important;
    border-radius: 8px !important;
    padding: 1rem !important;
    margin: 0.5rem 0 !important;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.1) !important;
}

.blog-content-area .faq-section h3 {
    color: #f57c00 !important;
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
    text-align: left !important;
    font-size: 1.4rem !important;
    font-weight: 600 !important;
}

.blog-content-area .faq-item {
    margin-bottom: 1rem !important;
}

.blog-content-area .faq-item:last-child {
    margin-bottom: 0 !important;
}

.blog-content-area .faq-item strong {
    color: #e65100 !important;
    font-weight: 600 !important;
}

/* CTA Section */
.blog-content-area .cta-section {
    background: linear-gradient(135deg, #1B5E20 0%, #0D47A1 100%) !important;
    color: white !important;
    padding: 1.5rem !important;
    border-radius: 10px !important;
    text-align: center !important;
    margin: 2rem 0 !important;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.3) !important;
}

.blog-content-area .cta-section h3 {
    color: white !important;
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
}

.blog-content-area .cta-section p {
    color: white !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    margin-bottom: 1rem !important;
}

.blog-content-area .cta-section .btn-primary {
    background: white !important;
    color: #1B5E20 !important;
    padding: 0.8rem 1.5rem !important;
    border-radius: 25px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    display: inline-block !important;
    margin-top: 0.5rem !important;
    border: none !important;
    font-size: 16px !important;
    transition: all 0.3s ease !important;
}

.blog-content-area .cta-section .btn-primary:hover {
    background: #f5f5f5 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

/* Scroll offset for anchor links */
.blog-content-area h2[id] {
    scroll-margin-top: 100px;
}

.blog-content-area h3[id] {
    scroll-margin-top: 100px;
}

/* Quick Reference Box Styling - Blue Box Design */
.quick-reference-box {
    background: #e0f2f7;
    border: 2px solid #a7d9e8;
    border-radius: 12px;
    padding: 1.8rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(167, 217, 232, 0.2);
}

.quick-reference-box h3 {
    color: #1976D2;
    margin-top: 0;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-reference-box h3::before {
    content: "▶ ";
    color: #1B5E20;
    font-size: 1.1em;
}

.quick-reference-box h4 {
    color: #1976D2;
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-reference-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.quick-reference-box li {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.quick-reference-box a {
    color: #1976D2;
    text-decoration: none;
    font-weight: 500;
}

.quick-reference-box a:hover {
    color: #0D47A1;
    text-decoration: underline;
}

/* Content illustration images (desktop tuned smaller) */
.blog-content-area img.content-illustration {
    display: block;
    max-width: 75%;
    height: auto;
    margin: 0.8rem auto 1.2rem;
    border-radius: 10px;
}

/* Large screens - additional width constraints */
@media (min-width: 1400px) {
    .blog-main-content {
        max-width: 1400px;
        padding: 0 3rem;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .blog-main-content {
        font-size: 14px;
        padding: 0 1rem;
    }
    
    .blog-detail-header {
        padding-top: 90px !important;
    }
    
    .blog-content-area h2[id] {
        scroll-margin-top: 100px;
    }
    
    .blog-content-area h3[id] {
        scroll-margin-top: 120px;
    }
    
    .blog-detail-meta {
        gap: 1rem !important;
        font-size: 0.85rem !important;
    }
    
    .blog-detail-header h1 {
        font-size: 1.4rem !important;
        padding-top: 0.5rem !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
        color: #1B5E20 !important;
        font-weight: 700 !important;
    }
    
    .blog-content-area h2 {
        font-size: 1.4rem;
        margin-top: 2rem;
        margin-bottom: 1rem;
    }
    
    .blog-content-area h3 {
        font-size: 1.2rem;
        margin-top: 1.5rem;
        margin-bottom: 0.7rem;
    }
    
    .quick-reference-box {
        padding: 1.2rem;
        margin: 1.5rem 0;
    }
    
    .quick-reference-box h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .quick-reference-box li {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    /* Mobile: illustrations full width */
    .blog-content-area img.content-illustration {
        max-width: 100%;
        margin: 0.6rem 0 1rem;
    }
    
    .blog-content-area p,
    .blog-content-area ul li,
    .blog-content-area ol li {
        font-size: 14px;
        margin-bottom: 1rem;
        line-height: 1.6;
    }
    
    .blog-content-area ul,
    .blog-content-area ol {
        padding-left: 1.8rem;
    }
    
    .toc-container {
        position: relative;
        top: auto;
        max-height: none;
        overflow-y: visible;
        margin: 1rem 0;
        padding: 1rem;
    }
    
    .toc-container h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .toc-container a {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }
    
    .toc-container ul ul {
        margin-left: 1rem;
        margin-top: 0.2rem;
    }
    
    .toc-container ul ul a {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

/* Recap Table Styles */
.recap-table {
    margin: 2rem 0;
    overflow-x: auto;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.recap-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recap-table th {
    background: linear-gradient(135deg, #1B5E20, #2E7D32);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.recap-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.recap-table tr:last-child td {
    border-bottom: none;
}

.recap-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.recap-table tr:hover {
    background-color: #e8f5e8;
    transition: background-color 0.2s ease;
}

.table-notes {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: #f5f5f5;
    border-left: 4px solid #4CAF50;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555;
}

/* Avoid Mistakes Box */
.avoid-mistakes-box {
    background: #fff3e0;
    border: 2px solid #ffb74d;
    border-radius: 12px;
    padding: 1.8rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(255, 183, 77, 0.2);
}

.avoid-mistakes-box h3 {
    color: #E65100;
    margin-top: 0;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avoid-mistakes-box h3::before {
    content: "▶ ";
    color: #1B5E20;
    font-size: 1.1em;
}

.avoid-mistakes-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.avoid-mistakes-box li {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.avoid-mistakes-box a {
    color: #E65100;
    text-decoration: none;
    font-weight: 500;
}

.avoid-mistakes-box a:hover {
    color: #BF360C;
    text-decoration: underline;
}

/* Mobile responsive styles for recap table and avoid mistakes box */
@media (max-width: 768px) {
    .recap-table {
        margin: 1.5rem 0;
    }

    .recap-table th,
    .recap-table td {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .avoid-mistakes-box {
        padding: 1.2rem;
        margin: 1.5rem 0;
    }
    
    .avoid-mistakes-box h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .avoid-mistakes-box li {
        font-size: 0.9rem;
        margin-bottom: 0.6rem;
    }
}
