/*
Theme Name: WapFlow Blog
Theme URI: https://wapflow.net
Author: WapFlow Team
Author URI: https://wapflow.net
Description: WapFlow için özel tasarlanmış minimal ve SEO odaklı WordPress blog teması.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wapflow-blog
*/

/* ==================== CSS RESET & VARIABLES ==================== */
:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --secondary: #fd7e14;
    --dark: #0f0f23;
    --dark-light: #1a1a3e;
    --text: #333333;
    --text-light: #666666;
    --bg: #f8f9fa;
    --white: #ffffff;
    --border: #e9ecef;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER ==================== */
.site-header {
    background: var(--dark) !important;
    /* Keep header dark in all modes */
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.site-header .main-nav a,
.site-header .lang-toggle,
.site-header .site-logo span {
    color: rgba(255, 255, 255, 0.8) !important;
    /* Ensure visibility on dark header */
}

.site-header .main-nav a:hover,
.site-header .main-nav .current-menu-item a {
    color: var(--primary);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: var(--transition);
}

.brand-logo:hover {
    transform: translateY(-1px);
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 211, 102, 0.1);
    border-radius: 12px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-icon img {
    height: 45px;
    width: 45px;
    object-fit: contain;
}

.brand-name {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.brand-name span {
    color: var(--primary);
}

/* Navigation */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 35px;
    align-items: center;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-size: 15px;
    padding: 8px 0;
    position: relative;
}

.main-nav a:hover,
.main-nav .current-menu-item a {
    color: var(--primary);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.main-nav a:hover::after,
.main-nav .current-menu-item a::after {
    width: 100%;
}

.back-to-app {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white) !important;
    padding: 10px 20px !important;
    border-radius: 8px;
    font-weight: 600;
}

.back-to-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* Mobile-only components hidden by default for desktop */
.menu-overlay,
.mobile-nav-header,
.mobile-nav-footer,
.menu-close {
    display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

/* Ensure header stays above overlay when menu is open */
body.menu-open .site-header {
    z-index: 2100 !important;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 5px 0;
    transition: var(--transition);
}

/* AJAX Search Styles */
.header-search {
    position: relative;
    margin-right: 15px;
}

.ajax-search-container {
    position: relative;
    width: 250px;
}

#ajax-search-input {
    width: 100%;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

#ajax-search-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    width: 300px;
}

#ajax-search-results {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: var(--dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    overflow: hidden;
    z-index: 1001;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-result-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info h4 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
}

.search-result-info span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ==================== HERO / PAGE HEADER ==================== */
.page-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    padding: 40px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(37, 211, 102, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.page-header h1 {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    position: relative;
}

.page-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    position: relative;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-top: 20px;
    position: relative;
}

.breadcrumbs a,
.breadcrumbs span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .separator {
    margin: 0 10px;
}

/* ==================== MAIN CONTENT ==================== */
.site-main {
    padding: 60px 0;
}

.content-area {
    max-width: 900px;
    margin: 0 auto;
}

/* ==================== BLOG POSTS ==================== */
.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-radius: var(--radius);
    background: var(--white);
}

@media (min-width: 768px) {
    .post-card {
        flex-direction: row;
        align-items: stretch;
    }

    .post-card .post-thumbnail {
        flex: 0 0 380px;
        aspect-ratio: auto;
        height: auto;
    }

    .post-card .post-content {
        flex: 1;
        padding: 30px 40px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-category {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary);
    color: var(--white);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.post-content {
    padding: 25px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-light);
}

.post-meta svg {
    width: 14px;
    height: 14px;
    margin-right: 5px;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--primary);
}

.post-excerpt {
    color: var(--text-light);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.read-more:hover {
    gap: 12px;
}

/* ==================== SINGLE POST ==================== */
.single-post-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 50px;
    box-shadow: var(--shadow);
}

.single-post-content .post-thumbnail {
    margin: -50px -50px 40px;
    border-radius: var(--radius) var(--radius) 0 0;
    aspect-ratio: 21/9;
}

.single-post-content .entry-content {
    font-size: 17px;
    line-height: 1.8;
}

.entry-content h2 {
    font-size: 1.75rem;
    margin: 40px 0 20px;
    color: var(--dark);
}

.entry-content h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
    color: var(--dark);
}

.entry-content p {
    margin-bottom: 20px;
}

.entry-content ul,
.entry-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.entry-content li {
    margin-bottom: 10px;
}

.entry-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 20px 30px;
    background: var(--bg);
    margin: 30px 0;
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.entry-content pre,
.entry-content code {
    background: var(--dark);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
}

.entry-content pre {
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.entry-content img {
    border-radius: var(--radius);
    margin: 30px 0;
}

/* Post Navigation */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.nav-previous,
.nav-next {
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-previous:hover,
.nav-next:hover {
    background: var(--primary);
}

.nav-previous:hover a,
.nav-next:hover a,
.nav-previous:hover .nav-label,
.nav-next:hover .nav-label,
body.dark-mode .nav-previous:hover a,
body.dark-mode .nav-next:hover a,
body.dark-mode .nav-previous:hover .nav-label,
body.dark-mode .nav-next:hover .nav-label {
    color: #ffffff !important;
    text-decoration: none !important;
}

.nav-next {
    text-align: right;
}

.nav-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 5px;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: sticky;
    top: 100px;
}

.widget {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
    color: var(--dark);
}

/* Search Widget */
.search-form {
    display: flex;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
    outline: none;
}

.search-form input[type="search"]:focus {
    border-color: var(--primary);
}

.search-form button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    transition: var(--transition);
}

.search-form button:hover {
    background: var(--primary-dark);
}

/* Categories Widget */
.widget ul {
    list-style: none;
}

.widget li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.widget li:last-child {
    border-bottom: none;
}

.widget li a {
    display: flex;
    justify-content: space-between;
    color: var(--text);
}

.widget li a:hover {
    color: var(--primary);
}

.widget li span {
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
}

/* Recent Posts Widget */
.recent-post {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.recent-post:last-child {
    border-bottom: none;
}

.recent-post-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.recent-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-post-content h4 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 5px;
}

.recent-post-content h4 a {
    color: var(--text);
}

.recent-post-content h4 a:hover {
    color: var(--primary);
}

.recent-post-date {
    font-size: 12px;
    color: var(--text-light);
}

/* CTA Widget */
.widget-cta {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    text-align: center;
}

.widget-cta .widget-title {
    color: var(--white);
    border-bottom-color: var(--primary);
}

.widget-cta p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.widget-cta .btn {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
}

.widget-cta .btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 60px;
    padding: 20px 0;
}

.pagination h2.screen-reader-text {
    display: none;
}

.pagination a,
.pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pagination a:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.2);
}

.pagination .current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
    transform: scale(1.05);
}

.pagination .dots {
    border: none;
    background: none;
    box-shadow: none;
    color: var(--text-light);
}

/* Dark Mode Pagination Adjustments */
body.dark-mode .pagination a,
body.dark-mode .pagination span.page-numbers:not(.current) {
    background: #1a1a3e;
    border-color: #27273f;
    color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body.dark-mode .pagination a:hover {
    background: #27273f;
    color: var(--primary);
    border-color: var(--primary);
}

@media (max-width: 576px) {
    .pagination {
        gap: 5px;
        flex-wrap: wrap;
    }

    .pagination a,
    .pagination span.page-numbers {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
        padding: 0 10px;
    }
}

/* ==================== FOOTER ==================== */
.site-footer {
    background: var(--dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 60px 0 30px;
}

.footer-widgets {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

.footer-widget h2,
.footer-widget h3,
.footer-widget h4 {
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    opacity: 1 !important;
    text-transform: none;
}

.footer-about p {
    margin-bottom: 25px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    max-width: 400px;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.3s ease;
}

.footer-social a:hover {
    background: var(--primary);
}

.footer-widget ul {
    list-style: none;
}

.footer-widget li {
    margin-bottom: 12px;
}

.footer-widget a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-widget a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-bottom p {
    font-size: 14px;
}

/* ==================== 404 PAGE ==================== */
.error-404 {
    text-align: center;
    padding: 80px 20px;
}

.error-404 h1 {
    font-size: 8rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 20px;
}

.error-404 h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.error-404 p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
    transform: translateY(-2px);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
    .content-area {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .footer-widgets {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {

    /* Force Grid Layout on Header Inner */
    header .header-inner {
        display: grid !important;
        grid-template-columns: 45px 1fr auto !important;
        grid-template-rows: auto auto !important;
        gap: 15px 10px !important;
        align-items: center !important;
        padding: 10px 0 !important;
        flex-wrap: nowrap !important;
        /* Prevent any flex-wrap behavior */
    }

    /* Row 1: Hamburger (left), Logo (center), Button (right) */
    .menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        grid-area: 1 / 1 !important;
        width: 45px !important;
    }

    .brand-logo {
        grid-area: 1 / 2 !important;
        margin-left: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: auto !important;
    }

    /* Use display: contents for the wrapper but position its direct children */
    .header-right {
        display: contents !important;
    }

    /* Button in Row 1, Col 3 */
    .header-right .back-to-app {
        grid-area: 1 / 3 !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        height: min-content !important;
        display: inline-block !important;
    }

    /* Row 2: Search (left), Language (right - below Button) */
    .header-search {
        grid-area: 2 / 1 / 2 / 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .lang-switcher {
        grid-area: 2 / 3 !important;
        justify-self: center !important;
        margin: 0 !important;
    }

    .ajax-search-container {
        width: 100% !important;
    }

    #ajax-search-input {
        width: 100% !important;
        min-width: 120px !important;
    }

    #ajax-search-input:focus {
        width: 100% !important;
    }

    /* Overlay for backdrop */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1900;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .menu-overlay.active {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }

    .mobile-nav-header,
    .mobile-nav-footer,
    .menu-close {
        display: flex !important;
    }

    /* Main Sidebar Nav */
    .main-nav {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        /* Slide-in starting position */
        width: 280px !important;
        height: 100% !important;
        background: var(--bg) !important;
        z-index: 2000 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2) !important;
        overflow-y: auto !important;
        border-right: 1px solid var(--border) !important;
    }

    .main-nav.active {
        left: 0 !important;
    }

    /* Mobile Header within Nav */
    .mobile-nav-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 20px 25px !important;
        border-bottom: 1px solid var(--border) !important;
        background: var(--bg-card, #f4f4f9) !important;
    }

    .mobile-nav-header .brand-name {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: var(--text) !important;
    }

    .menu-close {
        background: rgba(0, 0, 0, 0.05) !important;
        border: none !important;
        color: var(--text) !important;
        font-size: 1.5rem !important;
        line-height: 1 !important;
        cursor: pointer !important;
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }

    /* Menu List in Sidebar - ENSURE VERTICAL STACK */
    .main-nav ul {
        flex: 1 !important;
        padding: 15px 0 !important;
        margin: 0 !important;
        list-style: none !important;
        display: flex !important;
        flex-direction: column !important;
        /* Force stack */
        gap: 2px !important;
    }

    .main-nav li {
        width: 100% !important;
        border: none !important;
        display: block !important;
    }

    .main-nav a {
        display: flex !important;
        align-items: center !important;
        padding: 14px 25px !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        color: var(--text) !important;
        /* Force variable usage over header rule */
        transition: all 0.25s ease !important;
        width: 100% !important;
        opacity: 0.8 !important;
    }

    /* Mobile Nav Footer (Lang + Social) */
    .mobile-nav-footer {
        padding: 25px !important;
        border-top: 1px solid var(--border) !important;
        background: var(--bg-card, #f4f4f9) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .mobile-lang-switcher {
        width: 100% !important;
    }

    .mobile-lang-switcher .lang-toggle {
        width: 100% !important;
        justify-content: space-between !important;
        background: var(--bg) !important;
        border: 1px solid var(--border) !important;
        color: var(--text) !important;
        padding: 12px 15px !important;
        border-radius: 12px !important;
        font-weight: 500 !important;
    }

    .mobile-social-links {
        display: flex !important;
        gap: 15px !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
    }

    .mobile-social-links a {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 42px !important;
        height: 42px !important;
        background: var(--bg) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        color: var(--text) !important;
        /* Force variable usage over header rule */
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
        padding: 0 !important;
    }

    .mobile-social-links a svg {
        fill: currentColor !important;
    }

    .mobile-social-links a:hover {
        background: var(--primary) !important;
        color: #ffffff !important;
        /* Ensure white icon on green bg */
        transform: translateY(-5px) !important;
        box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4) !important;
        border-color: var(--primary) !important;
    }

    /* Fixed Language Menu position in sidebar footer (Open Upwards) */
    .mobile-nav-footer .lang-switcher {
        position: relative !important;
    }

    .mobile-nav-footer .lang-menu {
        top: auto !important;
        bottom: 110% !important;
        /* Open above the toggle */
        right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        transform: translateY(10px) !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
    }

    .mobile-nav-footer .lang-switcher:hover .lang-menu {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Dark Mode specific ensures */
    body.dark-mode .main-nav {
        background: #0f0f23 !important;
    }

    body.dark-mode .mobile-nav-header,
    body.dark-mode .mobile-nav-footer {
        background: #1a1a3e !important;
    }

    body.dark-mode .menu-close {
        background: rgba(255, 255, 255, 0.1) !important;
    }

    /* Light Mode specific ensures */
    body:not(.dark-mode) .main-nav {
        background: #ffffff !important;
    }

    body:not(.dark-mode) .mobile-nav-header,
    body:not(.dark-mode) .mobile-nav-footer {
        background: #f8f9fa !important;
    }

    body:not(.dark-mode) .mobile-social-links a,
    body:not(.dark-mode) .mobile-lang-switcher .lang-toggle {
        background: #ffffff !important;
        border-color: #e9ecef !important;
    }

    body:not(.dark-mode) .main-nav a,
    body:not(.dark-mode) .mobile-social-links a {
        color: #333333 !important;
    }

    body:not(.dark-mode) .lang-menu a {
        background-color: #fff !important;
    }

    /* Hide desktop elements */
    .desktop-lang-switcher {
        display: none !important;
    }

    body.menu-open {
        overflow: hidden !important;
    }
}

.posts-grid {
    grid-template-columns: 1fr !important;
}

.page-header h1 {
    font-size: 1.75rem !important;
}

.single-post-content {
    padding: 25px !important;
}

.single-post-content .post-thumbnail {
    margin: -25px -25px 25px !important;
}

@media (max-width: 768px) {
    .footer-widgets {
        grid-template-columns: 1fr !important;
    }
}

.footer-bottom {
    flex-direction: column !important;
    gap: 15px !important;
    text-align: center !important;
}

/* ==================== DARK MODE ==================== */
body.dark-mode {
    --text: #e4e4e7;
    --text-light: #a1a1aa;
    --bg: #0f0f23;
    --white: #1a1a3e;
    --border: #27273f;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .site-header {
    background: #0a0a15;
}

body.dark-mode .post-card,
body.dark-mode .widget,
body.dark-mode .single-post-content {
    background: #1a1a3e;
}

body.dark-mode .post-title a,
body.dark-mode .widget-title,
body.dark-mode .entry-content h2,
body.dark-mode .entry-content h3 {
    color: #fff;
}

body.dark-mode .entry-content blockquote {
    background: #27273f;
}

body.dark-mode .nav-previous,
body.dark-mode .nav-next {
    background: #27273f;
}

body.dark-mode .search-form input[type="search"] {
    background: #27273f;
    border-color: #3f3f5f;
    color: #fff;
}

body.dark-mode .widget li span {
    background: #27273f;
}

body.dark-mode .pagination a,
body.dark-mode .pagination span {
    background: #1a1a3e;
    color: #fff;
}

/* Footer Social Icons Dark Mode Fix */
body.dark-mode .footer-social a {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body.dark-mode .footer-social a:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: var(--transition);
    z-index: 999;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: var(--transition);
}

body:not(.dark-mode) .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg);
}

body:not(.dark-mode) .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0);
}

body.dark-mode .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0);
}

body.dark-mode .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg);
}

/* ==================== LANGUAGE SWITCHER ==================== */
.lang-switcher {
    position: relative;
}

.lang-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.lang-switcher:hover .lang-menu,
.lang-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.lang-menu a:last-child {
    border-bottom: none;
}

.lang-menu a:hover,
.lang-menu a.active {
    background: rgba(37, 211, 102, 0.1);
    color: var(--primary);
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ==================== RTL SUPPORT (Arabic) ==================== */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .main-nav ul {
    flex-direction: row-reverse;
}

body.rtl .post-category {
    left: auto;
    right: 15px;
}

body.rtl .breadcrumbs .separator {
    transform: scaleX(-1);
}

body.rtl .read-more {
    flex-direction: row-reverse;
}

body.rtl .nav-next {
    text-align: left;
}

body.rtl .nav-previous {
    text-align: right;
}

body.rtl .search-form input[type="search"] {
    border-radius: 0 var(--radius) var(--radius) 0;
}

body.rtl .search-form button {
    border-radius: var(--radius) 0 0 var(--radius);
}

body.rtl .entry-content ul,
body.rtl .entry-content ol {
    padding-left: 0;
    padding-right: 30px;
}

body.rtl .entry-content blockquote {
    border-left: none;
    border-right: 4px solid var(--primary);
    border-radius: var(--radius) 0 0 var(--radius);
}

body.rtl .widget li a {
    flex-direction: row-reverse;
}

body.rtl .recent-post {
    flex-direction: row-reverse;
}

body.rtl .footer-widgets {
    direction: rtl;
}

body.rtl .theme-toggle {
    right: auto;
    left: 30px;
}

/* ==================== ADVANCED RESPONSIVENESS ==================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .header-right {
        order: -1;
        flex: 1;
        justify-content: flex-end;
    }

    .theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Final Corrections */
@media (max-width: 768px) {
    .post-navigation {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
    }
}