/* === FONT & THEME VARIABLES === */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --hue-primary: 240; /* Indigo */
    --hue-secondary: 280; /* Magenta/Purple */
    --transition: 0.3s ease;

    /* Light Mode */
    --bg-main: #f8f9fc;
    --bg-glass: rgba(255, 255, 255, 0.5);
    --bg-card: #ffffff;
    --bg-subtle: #f1f3f8;
    --border: rgba(0, 0, 0, 0.08);
    --text-primary: #1a202c;
    --text-secondary: #5a677d;
    --shadow-color: 220, 40%, 50%;
    --primary: hsl(var(--hue-primary), 90%, 65%);
    --primary-dark: hsl(var(--hue-primary), 90%, 55%);
    --grad-1: hsl(var(--hue-primary), 100%, 85%);
    --grad-2: hsl(var(--hue-secondary), 100%, 90%);
}

.dark-mode {
    /* Dark Mode */
    --bg-main: #131824;
    --bg-glass: rgba(28, 35, 51, 0.5);
    --bg-card: #1c2333;
    --bg-subtle: #2a3346;
    --border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f4f9;
    --text-secondary: #a0aec0;
    --shadow-color: 220, 40%, 0%;
    --primary: hsl(var(--hue-primary), 80%, 70%);
    --primary-dark: hsl(var(--hue-primary), 80%, 80%);
    --grad-1: hsl(var(--hue-primary), 80%, 20%);
    --grad-2: hsl(var(--hue-secondary), 80%, 25%);
}

/* === BASE & LAYOUT === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color var(--transition), color var(--transition);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Aurora Gradient Background */
body::before, body::after {
    content: ''; position: fixed; z-index: -1;
    border-radius: 50%; filter: blur(150px);
    transition: background-color 0.5s;
}
body::before { width: 500px; height: 500px; background: var(--grad-1); top: -20%; left: -10%; animation: pulse 15s infinite alternate; }
body::after { width: 600px; height: 600px; background: var(--grad-2); bottom: -25%; right: -15%; animation: pulse 20s infinite alternate-reverse; }
@keyframes pulse { from { transform: scale(0.8); } to { transform: scale(1.2); } }

/* --- CHANGE 1: More robust container for consistent centering and margins --- */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px; /* Use padding for consistent gutters */
}
main { padding-top: 75px; } /* Offset for fixed header */

/* === TYPOGRAPHY & BUTTONS === */
h1, h2, h3 { font-weight: 700; line-height: 1.2; color: var(--text-primary); margin-bottom: 1rem; }
h2.section-title { font-size: 2.5rem; text-align: center; margin-bottom: 4rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); }
a { text-decoration: none; color: var(--primary); transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

.btn-primary {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    background-color: var(--primary);
    color: white !important; /* Ensure text is always visible */
    border: none;
    box-shadow: 0 4px 15px rgba(var(--shadow-color), 0.2);
    transition: all var(--transition);
    text-align: center;
}
.btn-primary:hover { transform: translateY(-3px); background-color: var(--primary-dark); box-shadow: 0 6px 20px rgba(var(--shadow-color), 0.3); }

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    transition: all var(--transition);
}
.btn-secondary:hover { background-color: var(--primary); color: white; transform: translateY(-3px); }

/* === HEADER === */
.header {
    background-color: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    position: fixed; top: 0; left: 0; width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    transition: padding var(--transition), background-color var(--transition);
}
.header.scrolled { box-shadow: 0 2px 10px rgba(var(--shadow-color), 0.05); }
.header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-img { height: 40px; }
.logo-text h1 { font-size: 1.3rem; margin-bottom: 0; color: var(--text-primary); }
.logo-text p { font-size: 0.75rem; color: var(--text-secondary); margin: 0; line-height: 1; }
.navbar ul { display: flex; list-style: none; gap: 25px; align-items: center; }
.navbar ul li a { color: var(--text-primary); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 20px; }

/* Theme Switcher */
.theme-switcher { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-subtle); transition: var(--transition); border-radius: 24px; border: 1px solid var(--border); }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 2px; bottom: 2px; background-color: white; transition: var(--transition); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.dark-mode .slider:before { background-color: var(--bg-main); }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.mobile-menu-btn { display: none; font-size: 1.5rem; cursor: pointer; color: var(--text-primary); }

/* === GENERIC PAGE STYLES === */
.page-hero { padding: 60px 0; text-align: center; background-color: var(--bg-subtle); }
.page-hero h1 { font-size: 2.8rem; }
.page-hero p { font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.blog-page-section, .contact-section, .blog-post-section { padding: 80px 0; }

/* === HERO SECTION (Homepage) === */
.hero { padding: 80px 0; text-align: center; }
.hero-content h2 { font-size: 3.5rem; max-width: 800px; margin: 0 auto 1.5rem; }
.hero-content p { font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem; }
.hero-image {
    margin-top: 3rem;
    position: relative;
    width: 100%;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(var(--shadow-color), 0.1);
    overflow: hidden;
    background-color: var(--bg-subtle);
}
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === AD SECTION === */
.ad-section { padding: 20px 0; }
.ad-banner { background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 15px; text-align: center; position: relative; min-height: 120px; display: flex; flex-direction: column; justify-content: center; }
.ad-banner span { position: absolute; top: 10px; right: 15px; font-size: 0.7rem; color: var(--text-secondary); }
.ad-placeholder { background-color: var(--bg-subtle); height: 80px; border-radius: 8px; }

/* === TOOLS & BLOG SECTION === */
.tools-section, .blog-section { padding: 80px 0; }
.tools-grid, .blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.tool-card, .blog-card { display: block; background-color: var(--bg-card); border-radius: 16px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.05); transition: all var(--transition); }
.tool-card:hover, .blog-card:hover { transform: translateY(-8px); box-shadow: 0 8px 25px rgba(var(--shadow-color), 0.1); border-color: var(--primary); }
.tool-image, .blog-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: var(--bg-subtle);
}
.tool-image img, .blog-image img { width: 100%; height: 100%; object-fit: cover; }
.tool-info, .blog-content { padding: 25px; }
.tool-info h3, .blog-content h3 { margin-bottom: 0.5rem; color: var(--text-primary); }
.tool-info p, .blog-content p { font-size: 0.95rem; margin-bottom: 1.5rem; }
.tool-link { font-weight: 600; color: var(--primary); }
.blog-category { font-size: 0.75rem; font-weight: 600; color: var(--primary); letter-spacing: 1px; margin-bottom: 0.5rem; display: block; }
.section-cta { text-align: center; margin-top: 3rem; }

/* === VIDEO SECTION === */
.video-section { padding: 80px 0; background-color: var(--bg-subtle); }
.video-container { position: relative; max-width: 900px; margin: 0 auto; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(var(--shadow-color), 0.1); aspect-ratio: 16 / 9; }
.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    /* --- FIX ADDED HERE --- */
    user-select: none;
    -webkit-user-select: none; /* For older browser compatibility */
}
.video-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.play-button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80px; height: 80px; background-color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; transition: transform var(--transition); }
.video-thumbnail:hover .play-button { transform: translate(-50%, -50%) scale(1.1); }
.video-iframe-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.video-iframe-wrapper iframe { width: 100%; height: 100%; border: none; }

/* === FEATURES SECTION === */
.features-section { padding: 80px 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.feature-card { background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 30px; text-align: center; }
.feature-icon { width: 60px; height: 60px; margin: 0 auto 1.5rem; background-color: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.feature-card h3 { margin-bottom: 0.5rem; }

/* === DONATION SECTION === */
.donation-section { padding: 80px 0; background-color: var(--bg-subtle); text-align: center; }
.donation-content h2 { font-size: 2.2rem; }
.donation-content p { max-width: 600px; margin: 0 auto 1.5rem; font-size: 1.1rem; }
.donate-btn-large { display: inline-flex; align-items: center; gap: 10px; padding: 15px 30px; font-size: 1.1rem; }

/* === CONTACT FORM === */
.contact-form { max-width: 600px; margin: 0 auto; background-color: var(--bg-card); padding: 30px; border-radius: 16px; border: 1px solid var(--border); }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-primary); }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background-color: var(--bg-subtle); color: var(--text-primary); font-family: var(--font-family); font-size: 1rem; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }

/* === BLOG PAGE LAYOUT & SIDEBAR === */
.blog-layout-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: flex-start;
}
.blog-sidebar {
    position: sticky;
    top: 95px;
    height: fit-content;
}
.sidebar-ad {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}
.sidebar-ad h4, .in-content-ad h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}
.sidebar-ad .ad-placeholder {
    min-height: 250px;
    height: auto;
}
.sidebar-cta {
    background-color: var(--bg-subtle);
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
}
.sidebar-cta h4 { color: var(--text-primary); margin-bottom: 10px; }
.sidebar-cta p { margin-bottom: 15px; font-size: 14px; color: var(--text-secondary); }
.sidebar-cta-link {
    background: var(--primary);
    color: white !important;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    display: inline-block;
}

/* === SINGLE BLOG POST PAGE === */
.blog-post-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px 40px;
    max-width: 800px;
    width: 100%;
}
.post-header {
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.post-header .back-to-blog {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.post-header .back-to-blog i { margin-right: 8px; }
.post-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.post-header .post-meta { font-size: 0.9rem; color: var(--text-secondary); }
.featured-image, .in-post-image {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
}
.featured-image img, .in-post-image img {
    width: 100%;
    height: auto;
    display: block;
}
.featured-image figcaption, .in-post-image figcaption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 0.8rem 0;
    background-color: var(--bg-subtle);
}
.post-body h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}
.post-body ul, .post-body ol {
    list-style-position: inside;
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}
.post-body ul li, .post-body ol li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}
.post-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.post-share {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.post-share h3 { font-size: 1.2rem; color: var(--text-primary); }
.post-share .social-links { justify-content: center; }

/* IN-CONTENT ADS */
.in-content-ad {
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 40px 0;
    text-align: center;
}
.in-content-ad .ad-placeholder {
    min-height: 100px;
    height: auto;
    background-color: var(--bg-card);
}

/* CTA BOXES */
.cta-box {
    padding: 25px;
    margin: 30px 0;
    text-align: center;
    border-radius: 10px;
}
.cta-box h3 { margin-bottom: 15px; }
.cta-box p { margin-bottom: 20px; }
.cta-box-info {
    background: #f0f7ff;
    border: 2px solid #007bff;
}
.cta-box-info h3 { color: #0056b3; }
.cta-box-info .cta-link { background: #007bff; color: white !important; padding: 12px 24px; text-decoration: none; border-radius: 5px; font-weight: bold; display: inline-block; }
.dark-mode .cta-box-info { background: #2a3346; border-color: var(--primary); }
.dark-mode .cta-box-info h3 { color: var(--primary-dark); }

.cta-box-gradient {
    background: linear-gradient(135deg, hsl(var(--hue-primary), 80%, 60%), hsl(var(--hue-secondary), 80%, 55%));
    color: white;
}
.cta-box-gradient h3, .cta-box-gradient p { color: white; }
.cta-box-gradient .cta-link-gradient { background: white; color: hsl(var(--hue-primary), 80%, 60%)) !important; padding: 15px 30px; text-decoration: none; border-radius: 25px; font-weight: bold; display: inline-block; transition: transform 0.3s ease; }

.cta-box-success {
    background: #e8f5e8;
    color: #155724;
}
.cta-box-success h3, .cta-box-success p { color: #155724; }
.cta-box-success .cta-link { background: #28a745; color: white !important; padding: 12px 24px; text-decoration: none; border-radius: 5px; font-weight: bold; display: inline-block; }
.dark-mode .cta-box-success { background: #283b29; color: #a7d7b7; }
.dark-mode .cta-box-success h3, .dark-mode .cta-box-success p { color: #a7d7b7; }

/* STYLED TABLE */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 0.9em;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}
.styled-table thead tr {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
    text-align: left;
}
.styled-table th, .styled-table td {
    padding: 12px 15px;
    border: 1px solid var(--border);
}
.styled-table tbody tr {
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-card);
}
.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid var(--primary);
}
.styled-table .highlight-row {
    font-weight: bold;
    background-color: #e8f5e8;
}
.dark-mode .styled-table .highlight-row {
    background-color: #283b29;
}

/* === FOOTER === */
.footer { background-color: var(--bg-card); color: var(--text-primary); padding: 60px 0 0; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h3 { margin-bottom: 1.5rem; font-size: 1.2rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: var(--text-secondary); }
.social-links { display: flex; gap: 15px; margin-top: 1.5rem; }
.social-links a { width: 40px; height: 40px; background: var(--bg-subtle); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.social-links a:hover { background-color: var(--primary); color: #fff; }
.footer-newsletter { display: flex; margin-bottom: 1rem; }
.footer-newsletter input { flex: 1; padding: 10px 15px; border: 1px solid var(--border); border-radius: 50px 0 0 50px; outline: none; background-color: var(--bg-subtle); color: var(--text-primary); }
.footer-newsletter input:focus { border-color: var(--primary); }
.footer-newsletter button { background: var(--primary); color: #fff; border: none; padding: 0 20px; border-radius: 0 50px 50px 0; cursor: pointer; }
.footer-bottom { text-align: center; padding: 20px 0; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 0.9rem; }

/* === RESPONSIVE STYLES === */
@media (max-width: 992px) {
    .hero-content h2 { font-size: 2.8rem; }
    
    /* --- CHANGE 2: Use Flexbox for reliable centering on mobile/tablet --- */
    .blog-layout-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 40px;
    }
    .blog-sidebar {
        position: static;
        max-width: 500px;
        width: 100%;
    }
}
@media (max-width: 768px) {
    main { padding-top: 65px; }
    
    .logo-img { height: 36px; }
    .logo-text h1 { font-size: 1.1rem; }
    .logo-text p { font-size: 0.7rem; }
    .header-actions { gap: 15px; }
    .mobile-menu-btn { font-size: 1.4rem; }

    .navbar { position: fixed; top: 65px; left: -100%; width: 100%; height: calc(100vh - 65px); background-color: var(--bg-main); transition: left var(--transition); padding: 30px; }
    .navbar.active { left: 0; }
    .navbar ul { flex-direction: column; align-items: flex-start; gap: 20px; }
    .mobile-menu-btn { display: block; }
    
    .hero-content h2 { font-size: 2.2rem; }
    .section-title { font-size: 2rem; }
    
    .btn-primary { padding: 12px 24px; font-size: 0.95rem; }
    .btn-secondary { padding: 10px 20px; font-size: 0.9rem; }
    .donate-btn-large { padding: 12px 24px; font-size: 1rem; }

    .tools-grid, .blog-grid, .features-grid { grid-template-columns: 1fr; }
    .blog-post-content { padding: 20px; }
    .post-header h1 { font-size: 2rem; }
}
@media (max-width: 576px) {
    .hero { padding: 60px 0; }
    
    .hero-content h2 { font-size: 2.0rem; }
    .hero-content p { font-size: 1.1rem; }
    
    .footer-grid { grid-template-columns: 1fr; }
}