/* ========================================================
   MICGBV Knowledge Hub — Clean Pragmatic Stylesheet
   Domain: knowledge.micgbv.mw
   ======================================================== */

:root {
    --primary-dark: #4a1243;
    --primary:      #7e2572;
    --primary-light:#9b3a8e;
    --secondary:    #ee7324;
    --secondary-hover:#d9631a;
    --neutral-bg:   #f8f4f8;
    --neutral-light:#f2eaf2;
    --text-dark:    #1e293b;
    --text-muted:   #64748b;
    --border-color: #e2e8f0;
    --radius-sm:    6px;
    --radius-md:    12px;
    --radius-lg:    18px;
    --shadow-sm:    0 2px 5px rgba(0,0,0,0.04);
    --shadow-md:    0 4px 15px rgba(74,18,67,0.08);
    --shadow-lg:    0 10px 30px rgba(74,18,67,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    background-color: #ffffff;
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--secondary); }

.kh-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Utilities */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.text-white { color: #ffffff !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--secondary) !important; }

/* Topbar */
.kh-topbar {
    background: var(--primary-dark);
    color: #e2e8f0;
    font-size: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.kh-topbar a { color: #e2e8f0; }
.kh-topbar a:hover { color: var(--secondary); }
.kh-topbar .divider { opacity: 0.3; margin: 0 8px; }
.btn-top-register {
    background: var(--secondary);
    color: #ffffff !important;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
}
.badge-admin-nav {
    background: rgba(255,255,255,0.15);
    color: #fff !important;
    padding: 3px 8px;
    border-radius: 12px;
}

/* Header & Navbar */
.kh-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}
.kh-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kh-logo {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
/* Real logo image in navbar */
.kh-logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}
/* Real logo image in footer */
.kh-footer-logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.kh-brand-text {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-weight: 800;
    font-size: 17px;
    color: var(--primary-dark);
    line-height: 1.2;
}
.brand-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.kh-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.kh-nav a {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    border-radius: 8px;
}
.kh-nav a:hover, .kh-nav a.active {
    background: var(--neutral-light);
    color: var(--primary);
}
.btn-nav-submit {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-radius: 20px !important;
    padding: 8px 18px !important;
}
.btn-nav-submit:hover {
    background: var(--primary-dark) !important;
}
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--primary);
    cursor: pointer;
}

/* Hero Section */
.kh-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 70%, #9d174d 100%);
    color: #ffffff;
    padding: 60px 0 70px;
    position: relative;
    overflow: hidden;
}
.hero-badge {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}
.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 38px;
    font-weight: 800;
    margin: 14px 0;
    line-height: 1.25;
}
.hero-sub {
    font-size: 16px;
    color: #cbd5e1;
    max-width: 720px;
    margin-bottom: 28px;
}

/* Hero Search Box */
.hero-search-box {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    padding: 24px 30px;
    max-width: 860px;
}
.search-input-wrap {
    display: flex;
    gap: 8px;
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-dark);
}
.btn-hero-search {
    background: var(--secondary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 24px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-hero-search:hover { background: var(--secondary-hover); }

/* Category Chips */
.cat-chip {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.cat-chip:hover, .cat-chip.active {
    background: #ffffff;
    color: var(--primary-dark);
    border-color: #ffffff;
}

/* Cards & Layout */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.res-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.25s ease;
}
.res-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
}
.res-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.res-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.35;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.res-abstract {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.res-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: auto;
}
.res-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.btn-card {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-card-primary { background: var(--primary); color: #fff; }
.btn-card-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-card-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-card-outline:hover { background: var(--primary); color: #fff; }

/* Buttons */
.btn-kh-primary {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-kh-primary:hover { background: var(--primary-dark); color: #ffffff; }

.btn-kh-secondary {
    background: var(--secondary);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-kh-secondary:hover { background: var(--secondary-hover); color: #ffffff; }

/* Forms */
.form-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 36px;
    max-width: 680px;
    margin: 0 auto;
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s ease;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(126,37,114,0.15);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Footer */
.kh-footer {
    background: var(--primary-dark);
    color: #cbd5e1;
    padding: 50px 0 20px;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 36px;
    margin-bottom: 40px;
}
.footer-col h5 {
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 6px;
    display: inline-block;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: #cbd5e1; font-size: 13px; }
.footer-col ul li a:hover { color: var(--secondary); }
.partner-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}
.partner-chips span {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}
.btn-api-feed {
    background: rgba(255,255,255,0.15);
    color: #fff !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    font-size: 12px;
    color: #94a3b8;
}

@media (max-width: 992px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .hero-title { font-size: 30px; }
}
@media (max-width: 768px) {
    .kh-nav { display: none; }
    .kh-nav.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: #ffffff;
        padding: 20px;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border-color);
    }
    .mobile-toggle { display: block; }
    .footer-grid { grid-template-columns: 1fr; }
}

/* === Professional Search Enhancements === */
.search-input-wrap input::placeholder { color: #94a3b8; }
.search-input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(238,115,36,0.3), 0 4px 20px rgba(0,0,0,0.15);
}
.category-filter-bar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 72px;
    z-index: 900;
}
.res-card { gap: 0; }
.res-card .res-title { margin-top: 4px; }

/* === Category Hub Grid Professional === */
.cat-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.cat-hub-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}
.cat-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
    color: inherit;
}
.cat-hub-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    font-size: 24px;
}
.cat-hub-title { font-weight: 800; font-size: 14px; color: var(--primary-dark); margin-bottom: 4px; }
.cat-hub-count { font-size: 12px; color: var(--text-muted); }

/* Stats strip */
.stats-strip {
    background: var(--primary-dark);
    color: #fff;
    padding: 28px 0;
}
.stats-strip .stat-num {
    font-size: 36px; font-weight: 800; color: var(--secondary);
}
.stats-strip .stat-label {
    font-size: 13px; color: #cbd5e1; margin-top: 4px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    text-align: center;
}
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .kh-logo-img, .kh-footer-logo-img { width: 40px; height: 40px; }
}

/* Responsive display helpers */
.d-none { display: none !important; }
.d-block { display: block !important; }
@media (min-width: 992px) {
    .d-lg-block { display: block !important; }
    .d-lg-none  { display: none  !important; }
}
/* Fix hero grid on small screens */
@media (max-width: 991px) {
    .kh-hero .kh-container {
        grid-template-columns: 1fr !important;
    }
}
/* Make hero-search-box full-width inside grid */
.hero-search-box { width: 100%; }
