/* --- VARIABLES & RESET --- */
:root {
    --primary-color: #311b92; /* Deep Indigo */
    --primary-light: #6746c3;
    --accent-color: #00bcd4; /* Cyan details */
    --text-dark: #333333;
    --text-gray: #5f6368;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(49, 27, 146, 0.1);
    --radius-md: 12px;
    --radius-round: 50px;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
    --max-width: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--primary-color); }

/* --- NAVIGATION BAR (UPDATED) --- */
.navbar {
    background: var(--bg-white);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid rgba(49, 27, 146, 0.1);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between; /* Logo Left, Actions Right */
    align-items: center;
}

/* Logo */
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1002;
}
.logo i { color: var(--accent-color); }

/* Nav Links (Desktop) */
.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-left: auto; /* Push to right */
    margin-right: 30px; /* Space between links and icons */
}

.nav-links a {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary-color); }

/* Right Side Icons Container */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-trigger {
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.search-trigger:hover { transform: scale(1.1); }

.mobile-toggle {
    display: none; /* Hidden on Desktop */
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
}

/* --- HOME HERO SECTION --- */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 80px 20px;
    text-align: center;
    color: var(--bg-white);
}
.hero h1 { color: var(--bg-white); font-size: 3rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem; opacity: 0.9; }

/* --- SEARCH BOX UPDATED (Responsive Fix) --- */
.search-box-wrapper {
    background: var(--bg-white);
    padding: 6px; /* Nimepunguza kidogo padding ya nje */
    border-radius: var(--radius-round);
    
    /* Hapa ndio fix ilipo: */
    width: 100%;           /* Hakikisha inachukua nafasi iliyopo tu */
    max-width: 600px;      /* Isizidi 600px kwenye desktop */
    margin: 0 auto;
    
    display: flex;
    align-items: center;   /* Hakikisha viko center vertically */
    gap: 5px;              /* Nafasi kati ya input na button */
    
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    box-sizing: border-box; /* Muhimu sana isizidishe width */
}

.search-box-wrapper input {
    flex: 1;               /* Ichukue nafasi yote iliyobaki */
    min-width: 0;          /* MUHIMU: Hii inazuia input kutanuka na kupasua screen */
    border: none;
    padding: 12px 15px;    /* Nimepunguza padding kidogo iwe safe */
    outline: none;
    font-size: 1rem;
    border-radius: var(--radius-round);
    background: transparent; /* Iwe na rangi ya wrapper */
}

.search-box-wrapper button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;    /* Punguza padding ya button kidogo */
    border-radius: var(--radius-round);
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;   /* Zuia maneno kukatika */
    transition: transform 0.2s;
    flex-shrink: 0;        /* Zuia button isiminywe ikapotea */
}

.search-box-wrapper button:hover {
    transform: scale(1.05);
}


@media (max-width: 768px) {
    /* ... code zako zingine za mobile ... */

    /* Fix maalum ya Search Box kwenye simu */
    .search-box-wrapper {
        padding: 4px;      /* Punguza wrapper padding */
        max-width: 100%;   /* Hakikisha haizidi kioo */
    }

    .search-box-wrapper input {
        padding: 10px 12px; /* Punguza input padding */
        font-size: 0.95rem; /* Punguza font kidogo isijae sana */
    }

    .search-box-wrapper button {
        padding: 10px 18px; /* Punguza button size */
        font-size: 0.9rem;
    }
}


/* --- SECTIONS --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 60px 20px; }
.section-header { text-align: center; margin-bottom: 50px; }
.section-header h2 { font-size: 2.2rem; margin-bottom: 10px; }
.section-header p { color: var(--text-gray); max-width: 700px; margin: 0 auto; }

/* --- CARDS & GRID --- */
.perspectives-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.perspective-card {
    background: var(--bg-white); padding: 40px 20px; text-align: center;
    border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: 0.3s;
}
.perspective-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.perspective-icon { font-size: 3rem; color: var(--primary-color); margin-bottom: 20px; }

.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.post-card {
    background: var(--bg-white); border-radius: var(--radius-md); overflow: hidden;
    box-shadow: var(--shadow-sm); transition: 0.3s; display: flex; flex-direction: column;
}
.post-card:hover { box-shadow: var(--shadow-md); }
.post-img { height: 200px; background: #ddd; position: relative; overflow: hidden; }
.post-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.post-card:hover .post-img img { transform: scale(1.1); }
.post-content { padding: 25px; flex: 1; display: flex; flex-direction: column; }
.post-meta { font-size: 0.85rem; color: var(--text-gray); margin-bottom: 10px; }
.post-title { font-size: 1.4rem; margin-bottom: 15px; line-height: 1.3; }
.post-excerpt { font-size: 0.95rem; color: var(--text-gray); margin-bottom: 20px; flex: 1; }
.read-more-btn { align-self: flex-start; color: var(--primary-color); font-weight: 700; text-transform: uppercase; font-size: 0.85rem; }

/* --- PAGE SPECIFIC --- */
.search-results-header { background: var(--bg-white); padding: 40px 20px; border-bottom: 1px solid var(--border-color); }
.article-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 50px; }
.sidebar-widget { background: var(--bg-white); padding: 30px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.side-post { display: flex; gap: 15px; margin-bottom: 20px; align-items: center; }
.side-post img { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; }
.side-post-info h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 700; }
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 50px; }
.page-btn {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg-white); border: 1px solid var(--border-color);
}
.page-btn.active, .page-btn:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* --- FOOTER --- */
footer { background: linear-gradient(to right, #1a1a2e, #16213e); color: white; padding: 80px 20px 20px; margin-top: auto; }
footer h3{color: #fff}
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; max-width: var(--max-width); margin: 0 auto 60px; }
.footer-links a { color: #b0b0b0; font-size: 0.95rem; }
.footer-links a:hover { color: var(--accent-color); }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); color: #888; }

/* --- MODAL --- */
.search-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s;
}
.search-modal.active { opacity: 1; pointer-events: auto; }
.modal-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 2rem; cursor: pointer; }

/* --- FLOATING BUTTONS (UPDATED) --- */
.float-btn {
    width: 50px; height: 50px;
    background: var(--bg-white); color: var(--primary-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer; font-size: 1.2rem;
    transition: 0.3s;
    z-index: 900;
}
.float-btn:hover { background: var(--primary-color); color: white; transform: translateY(-3px); }

/* Share Button - Bottom Left */
.share-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
}

/* Scroll Top Button - Bottom Right */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
.scroll-top-btn.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* --- RESPONSIVE --- */
@media (max-width: 992px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .article-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Navbar Mobile Styles */
    .nav-links {
        position: absolute; top: 100%; left: 0; width: 100%;
        background: var(--bg-white); flex-direction: column;
        padding: 20px; box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-color);
        display: none; margin-right: 0;
    }
    .nav-links.active { display: flex; animation: slideDown 0.3s forwards; }
    
    .mobile-toggle { display: block; margin-left: 0; }
    .nav-right { gap: 15px; } /* Closer together on mobile */
    
    .logo { font-size: 1.2rem; }
    .hero h1 { font-size: 2rem; }
    .posts-grid { grid-template-columns: 1fr; }
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }


/* --- ARTICLE TYPOGRAPHY UPDATES --- */

.article-body {
    font-size: 1.15rem; /* Nimeongeza ukubwa kidogo uwe msafi (approx 18px) */
    line-height: 1.9;   /* Nafasi kati ya mstari na mstari (Line Height) */
    color: #2c2c2c;     /* Rangi nzito kidogo kuliko gray kwa kusoma */
}

/* Hapa ndio tunapo tenganisha Paragraphs */
.article-body p {
    margin-bottom: 2rem; /* Nafasi kubwa chini ya kila paragraph (kama 32px) */
    margin-top: 0;       /* Top tunaacha 0 ili isigongane na headings */
}

/* Tunaboresha pia Headings (H2, H3) ndani ya article zisiingiliane na text */
.article-body h2, 
.article-body h3 {
    margin-top: 1rem;    /* Nafasi kubwa juu ya kichwa cha habari kipya */
    margin-bottom: 1rem; /* Nafasi ndogo chini yake kabla ya paragraph kuanza */
    line-height: 1.3;
    color: var(--primary-color);
}

/* Kama una list ndani ya article */
.article-body ul, 
.article-body ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.8rem; /* Nafasi kati ya point moja na nyingine */
}

/* Kwaajili ya quotes */
.article-body blockquote {
    border-left: 4px solid var(--accent-color);
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    background: #f0f4f8; /* Kijivuli chepesi sana */
    font-style: italic;
    font-family: var(--font-heading);
    color: #555;
    border-radius: 0 12px 12px 0;
}