
/* Reset & Base Variables */
:root {
    --primary-color: #3730A3;
    --primary-hover: #4338CA;
    --text-main: #1F2937;
    --text-light: #4B5563;
    --bg-main: #FFFFFF;
    --bg-alt: #F3F4F6;
    --border-color: #E5E7EB;
    --footer-bg: #111827;
    --footer-text: #D1D5DB;
}



* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background-color: var(--bg-main); color: var(--text-main); line-height: 1.6; transition: background-color 0.3s, color 0.3s; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.highlight { color: var(--primary-color); }

/* --- Top Bar --- */
.top-bar { background-color: var(--bg-alt); font-size: 0.85rem; padding: 8px 0; border-bottom: 1px solid var(--border-color); color: var(--text-light); }
.top-bar-inner { display: flex; justify-content: space-between; align-items: center; }
.top-social a { margin-left: 10px; font-weight: 600; }

/* --- Main Header --- */
.main-header { background-color: var(--bg-main); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 70px; }
.logo-text { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-main); cursor: pointer; }

.main-nav { display: flex; align-items: center; gap: 30px; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { font-weight: 600; color: var(--text-light); transition: color 0.2s; padding: 5px 0; }
.nav-links a:hover, .nav-links a.active { color: var(--primary-color); }

.nav-actions { display: flex; gap: 15px; }
.nav-actions button { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-light); transition: transform 0.2s; }
.nav-actions button:hover { transform: scale(1.1); color: var(--primary-color); }

/* --- Main Content Placeholder --- */
.main-content { min-height: 60vh; padding: 60px 0; }
.hero-placeholder { text-align: center; padding: 40px; background: var(--bg-alt); border-radius: 12px; border: 1px dashed var(--border-color); }

/* --- Footer --- */
.main-footer { background-color: var(--footer-bg); color: var(--footer-text); padding-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-col h3 { color: #fff; font-size: 1.5rem; margin-bottom: 15px; }
.footer-col h4 { color: #fff; font-size: 1.1rem; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 1px; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul li a { transition: color 0.2s; }
.footer-col ul li a:hover { color: var(--primary-color); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; font-size: 0.9rem; }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .top-bar { display: none; }
    .mobile-menu-btn { display: block; }
    .main-nav { display: none; flex-direction: column; position: absolute; top: 70px; left: 0; width: 100%; background: var(--bg-main); padding: 20px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
    .main-nav.show { display: flex; }
    .nav-links { flex-direction: column; width: 100%; text-align: center; }
    .footer-grid { grid-template-columns: 1fr; gap: 30px; text-align: center; }
}

/* --- SVG Icons --- */
.svg-icon { width: 20px; height: 20px; fill: currentColor; }
.search-btn { display: flex; align-items: center; justify-content: center; }

/* --- FAQ Section --- */
.faq-section { margin: 40px 0; background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.faq-item { border-bottom: 1px solid var(--border-color); padding: 15px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-question { font-weight: 600; font-size: 1.1rem; color: var(--primary-color); margin-bottom: 10px; }
.faq-answer { color: var(--text-light); line-height: 1.7; }

/* --- Author Profile --- */
.author-profile { display: flex; flex-wrap: wrap; gap: 30px; background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin: 40px 0; }
.author-img-wrapper { flex: 0 0 150px; }
.author-img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary-color); }
.author-info { flex: 1; min-width: 250px; }
.author-name { font-size: 1.8rem; font-weight: bold; margin-bottom: 10px; color: var(--text-main); }
.author-bio { color: var(--text-light); line-height: 1.8; font-size: 1.05rem; }

/* --- Content Sections --- */
.seo-content-block { background: #fff; padding: 40px; border-radius: 12px; margin-bottom: 30px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.seo-content-block h2 { color: var(--text-main); margin-bottom: 20px; font-size: 1.8rem; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; display: inline-block; }
.seo-content-block p { margin-bottom: 15px; color: var(--text-light); font-size: 1.1rem; text-align: justify; }

/* Sidebar Layout Updates */
.layout-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    display: flex;
    gap: 40px;
    padding: 0 20px;
}
.blog-container.main-col {
    flex: 1;
    max-width: 800px;
    margin: 0; 
    box-sizing: border-box;
}
.sidebar-col {
    width: 340px;
    flex-shrink: 0;
}
@media(max-width: 992px) {
    .layout-wrapper {
        flex-direction: column;
    }
    .sidebar-col {
        width: 100%;
    }
}

/* Sidebar Widgets */
.sidebar-widget {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.sidebar-widget h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}
/* Search */
.search-box {
    display: flex;
    gap: 10px;
}
.search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    font-size: 1rem;
}
.search-box button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}
/* Popular Posts */
.popular-post-item {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}
.popular-post-item:last-child { margin-bottom: 0; }
.popular-post-item img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
}
.popular-post-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    line-height: 1.4;
}
.popular-post-title:hover { color: var(--primary-color); }
.popular-post-date {
    font-size: 0.85rem;
    color: var(--text-light);
    display: block;
    margin-top: 4px;
}
/* Categories */
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { margin-bottom: 10px; }
.cat-list li a {
    display: flex;
    justify-content: space-between;
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.05rem;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-radius: 6px;
    transition: 0.2s;
}
.cat-list li a:hover { background: var(--primary-color); color: #fff; }
/* AdSpace */
/* 3-Column Mega Guide Layout */
.layout-mega {
    max-width: 1400px;
    margin: 40px auto;
    display: flex;
    gap: 30px;
    padding: 0 20px;
    align-items: flex-start;
}
.col-toc {
    width: 260px;
    position: sticky;
    top: 30px;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    flex-shrink: 0;
}
.col-toc h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.col-toc ul { list-style: none; padding: 0; margin: 0; }
.col-toc ul li { margin-bottom: 12px; line-height: 1.5; }
.col-toc ul li a { 
    text-decoration: none; 
    color: var(--text-light); 
    font-size: 1.05rem; 
    font-weight: 500; 
    transition: 0.2s; 
    display: block;
}
.col-toc ul li a:hover { color: var(--primary-color); padding-left: 5px; }
.col-main {
    flex: 1;
    min-width: 0;
}
.col-right {
    width: 320px;
    flex-shrink: 0;
}
@media(max-width: 1100px) {
    .layout-mega { flex-direction: column; }
    .col-toc, .col-right { width: 100%; position: static; }
}

/* Article Inner Styles (Fixed Profile Image) */
.blog-container { background:#fff; padding:40px; border-radius:12px; border:1px solid var(--border-color); box-shadow:0 4px 15px rgba(0,0,0,0.02); }
@media(max-width:768px){ .blog-container{ padding:25px; } }

.blog-header h1 { font-size:2.5rem; color:var(--text-main); margin-bottom:15px; line-height:1.3; }
.blog-meta { display:flex; align-items:center; gap:15px; color:var(--text-light); font-size:1rem; margin-bottom:30px; border-bottom:1px solid var(--border-color); padding-bottom:20px; flex-wrap:wrap; }
.blog-meta img { width:50px !important; height:50px !important; max-width:50px !important; border-radius:50%; object-fit:cover; border:2px solid var(--primary-color); display:block; }
.blog-meta .author-name { font-weight:bold; color:var(--primary-color); font-size:1.1rem; }

.blog-content h2 { font-size:1.9rem; color:var(--primary-color); margin-top:55px; margin-bottom:18px; padding-bottom:10px; border-bottom:1px dashed var(--border-color); scroll-margin-top: 40px; }
.blog-content h3 { font-size:1.4rem; color:var(--text-main); margin-top:28px; margin-bottom:12px; }
.blog-content p { font-size:1.15rem; line-height:1.95; color:var(--text-light); margin-bottom:22px; text-align:justify; }

.blog-content ul, .blog-content ol { margin-bottom:22px; padding-left:25px; }
.blog-content li { font-size:1.15rem; color:var(--text-light); margin-bottom:12px; line-height:1.85; }
.blog-content strong { color:var(--text-main); }
.blog-content a { color:var(--primary-color); font-weight:600; text-decoration:underline; text-underline-offset:3px; }

.blog-content blockquote { margin: 30px 0; padding: 20px 25px; border-left: 4px solid var(--primary-color); background-color: var(--bg-alt); font-size: 1.15rem; font-style: italic; color: var(--text-main); border-radius: 0 8px 8px 0; }
.blog-content table { width: 100%; border-collapse: collapse; margin: 30px 0; font-size: 1.05rem; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.blog-content th, .blog-content td { border: 1px solid var(--border-color); padding: 16px; text-align: left; vertical-align: top; }
.blog-content th { background-color: var(--primary-color); color: #fff; }
.blog-content tr:nth-child(even) { background-color: var(--bg-alt); }

.article-banner { width:100%; border-radius:12px; margin-bottom:30px; box-shadow:0 4px 12px rgba(0,0,0,0.1); display:block; }
.author-box { margin-top:50px; padding:30px; background:var(--bg-alt); border-radius:12px; border:1px solid var(--border-color); }
.author-box-inner { display:flex; gap:25px; align-items:center; flex-wrap:wrap; }
.author-box img { width:85px !important; height:85px !important; max-width:85px !important; border-radius:50%; border:3px solid var(--primary-color); object-fit:cover; display:block; }


/* --- Mobile Responsive Fixes --- */
@media (max-width: 768px) {
    .layout-wrapper, .layout-mega, .container {
        padding: 0 10px !important;
        margin-top: 20px !important;
        margin-bottom: 20px !important;
    }
    .blog-container, .seo-content-block, .author-profile {
        padding: 15px !important;
    }
    .blog-header h1 {
        font-size: 1.8rem !important;
        line-height: 1.4 !important;
    }
    .blog-content h2 {
        font-size: 1.5rem !important;
        margin-top: 30px !important;
    }
    .blog-content h3 {
        font-size: 1.3rem !important;
    }
    .blog-content p, .blog-content li {
        font-size: 1.05rem !important;
        line-height: 1.6 !important;
    }
}

/* --- Header Layout Updates for Mobile Search --- */
.header-inner {
    display: flex;
    align-items: center;
}
.logo {
    margin-right: auto !important; /* Pushes nav-actions and menu to the right */
}
.nav-actions {
    margin-right: 20px;
}

@media (max-width: 768px) {
    .nav-actions {
        margin-right: 15px;
    }
    .search-container {
        margin-right: 0 !important;
    }
    #searchInput {
        width: 140px !important;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }
    #searchResults {
        width: 250px !important;
        right: -30px !important;
    }
}

/* --- Mobile Author Box Fix --- */
@media (max-width: 768px) {
    .author-box-inner {
        flex-direction: column !important;
        text-align: center !important;
        justify-content: center !important;
    }
    .author-box img {
        margin: 0 auto !important;
    }
}

/* --- Header Layout Updates for Mobile Search --- */
.header-inner {
    display: flex;
    align-items: center;
}
.logo {
    margin-right: auto !important; /* Pushes nav-actions and menu to the right */
}
.nav-actions {
    margin-right: 20px;
}

@media (max-width: 768px) {
    .nav-actions {
        margin-right: 15px;
    }
    .search-container {
        margin-right: 0 !important;
    }
    #searchInput {
        width: 140px !important;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }
    #searchResults {
        width: 250px !important;
        right: -30px !important;
    }
    /* Mobile Author Box Fix */
    .author-box-inner {
        flex-direction: column !important;
        text-align: center !important;
        justify-content: center !important;
    }
    .author-box img {
        margin: 0 auto !important;
    }
}


/* --- Fix Footer Accessibility Contrast on Dark Background --- */
.main-footer .highlight {
    color: #A5B4FC !important; /* Lighter indigo for dark background */
}
.footer-col p {
    color: #E5E7EB !important; /* Very light gray to guarantee AAA contrast */
}
.footer-bottom p {
    color: #9CA3AF !important; 
}


/* --- Fix Image Aspect Ratio and Overflow --- */
img {
    height: auto;
}
.article-banner {
    height: auto !important;
    aspect-ratio: 16/9;
    object-fit: cover;
}
.card-img-wrapper img {
    height: 100% !important;
    object-fit: cover;
}

/* --- MODERN RESPONSIVE HEADER --- */
.header-logo-img { height: 35px; width: auto; object-fit: contain; }
@media (max-width: 768px) {
    .header-logo-img { height: 28px; } /* Even smaller on mobile to ensure it fits perfectly */
}

.header-inner { display: flex; justify-content: space-between; align-items: center; height: 70px; position: relative; }

.header-actions-wrapper { display: flex; align-items: center; gap: 15px; }

.icon-btn { background: none; border: none; color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 5px; outline: none; }
.icon-btn:hover { color: var(--primary-color); }

.desktop-nav { display: none; }
@media (min-width: 800px) {
    .desktop-nav { display: block; }
    .hamburger-btn { display: none !important; }
}
.desktop-nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; }
.desktop-nav ul li a { font-weight: 600; color: var(--text-light); transition: color 0.2s; text-decoration: none; }
.desktop-nav ul li a:hover { color: var(--primary-color); }

/* Search Bar Dropdown */
.search-dropdown-wrapper {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--bg-main);
    padding: 15px 20px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-top: 1px solid var(--border-color);
    z-index: 999;
}
.search-dropdown-wrapper.active { display: block; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

#searchInput {
    width: 100%; padding: 12px 20px; border-radius: 30px; border: 1px solid var(--border-color); background: var(--bg-alt); color: var(--text-main); font-size: 1rem; outline: none;
}

/* Slide-out Menu (Right to Left) */
.mobile-side-menu {
    position: fixed; top: 0; right: -300px; width: 280px; height: 100vh; background: var(--bg-main);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1); z-index: 10000; transition: right 0.3s ease;
    display: flex; flex-direction: column; padding: 30px 20px;
}
.mobile-side-menu.active { right: 0; }

.close-menu-btn { align-self: flex-end; background: none; border: none; font-size: 2.5rem; color: var(--text-main); cursor: pointer; margin-bottom: 30px; line-height: 1; }

.mobile-side-menu ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 20px; }
.mobile-side-menu ul li a { font-size: 1.2rem; font-weight: 600; color: var(--text-main); text-decoration: none; display: block; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }

.menu-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 9999; display: none; opacity: 0; transition: opacity 0.3s ease; }
.menu-overlay.active { display: block; opacity: 1; }

/* Mobile TOC FAB */
.toc-fab {
    display: none;
    position: fixed; bottom: 25px; right: 25px;
    background: #16a34a; color: #fff;
    padding: 14px 24px; border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9000; border: none; font-weight: bold; font-size: 1.1rem; cursor: pointer;
}
@media (max-width: 900px) {
    .col-toc { display: none !important; }
    .toc-fab { display: block; }
}

/* Modal for TOC */
.toc-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7); z-index: 10000;
    align-items: center; justify-content: center;
}
.toc-modal.active { display: flex; animation: fadeIn 0.2s ease; }

.toc-modal-content {
    background: var(--bg-main); width: 90%; max-width: 400px;
    border-radius: 12px; padding: 25px; position: relative;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.toc-modal-close {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 2rem; color: var(--text-main); cursor: pointer; line-height: 1;
}
.toc-modal-content ul { list-style: none; padding: 0; margin: 0; }
.toc-modal-content ul li { margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.toc-modal-content ul li:last-child { border-bottom: none; }
.toc-modal-content ul li a { color: var(--text-main); text-decoration: none; font-weight: 500; display: block; }
.toc-modal-content ul li a:hover { color: var(--primary-color); }

/* --- Mobile Topics FAB --- */
.topics-fab {
    display: none;
    position: fixed; bottom: 20px; right: 20px;
    background: #16a34a; color: #fff;
    padding: 12px 24px; border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9000; border: none; font-weight: bold; font-size: 1.1rem; cursor: pointer;
}
@media (max-width: 900px) {
    .sidebar-col { display: none !important; }
    .topics-fab { display: block; }
}

.topics-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7); z-index: 10000;
    align-items: center; justify-content: center;
}
.topics-modal.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.topics-modal-content {
    background: var(--bg-main); width: 90%; max-width: 400px;
    border-radius: 12px; padding: 25px; position: relative;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.topics-modal-close {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 2rem; color: var(--text-main); cursor: pointer; line-height: 1;
}
.topics-modal-content ul { list-style: none; padding: 0; margin: 0; }
.topics-modal-content ul li { margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.topics-modal-content ul li:last-child { border-bottom: none; }
.topics-modal-content ul li a { color: var(--text-main); text-decoration: none; font-weight: 500; display: block; font-size: 1.1rem; }
.topics-modal-content ul li a:hover { color: var(--primary-color); }





/* --- Table & Overflow Global Fix --- */
.layout-wrapper {
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.blog-container.main-col {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.table-responsive-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important; /* Forces it to respect parent padding, unlike 100vw */
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 30px 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}
.blog-content table {
    display: table !important;
    width: 100% !important;
    min-width: 600px !important; /* Table scrolls inside wrapper */
    margin: 0 !important; 
    border-collapse: collapse !important;
}
.blog-content th, .blog-content td {
    white-space: normal !important;
    word-break: normal !important;
}

pre, code {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
pre {
    overflow-x: auto !important;
}
/* --------------------------------- */
