@font-face {
    font-family: 'mef1';
    src: url('/fonts/frontend/Khmer MEF1 Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'mef2';
    src: url('/fonts/frontend/Khmer MEF2 Regular.ttf') format('truetype');
}

html[lang="km"] body,
html[lang="km"] p {
    font-family: 'mef1', sans-serif !important;
    line-height: 1.8 !important;
}

html[lang="km"] h1,
html[lang="km"] h2,
html[lang="km"] h3,
html[lang="km"] h4,
html[lang="km"] h5 {
    font-family: 'mef2', sans-serif !important;
    line-height: 1.6 !important;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* --- 1. Container --- */
.container,
.container-lg,
.container-md,
.container-sm,
.container-xl {
    max-width: 1200px;
    /* Limit container width for layout */
}

@media (max-width: 767.98px) {

    .container,
    section.container {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}


body {
    font-family: 'Roboto', "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif !important;
    font-size: 1.0625rem;
    line-height: 1.6;
    background-color: #fcfcfc;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Khmer Font Size Override */
html[lang="km"] body {
    font-size: 1.1rem;
}

/* Typography Configuration */
h1,
.h1 {
    font-size: 2.8rem;
}

@media (min-width: 768px) {

    h1,
    .h1 {
        font-size: 3.5rem;
    }
}

h2,
.h2 {
    font-size: 2.0rem;
}

@media (min-width: 768px) {

    h2,
    .h2 {
        font-size: 2.5rem;
    }
}

h3,
.h3 {
    font-size: 1.5rem;
}

@media (min-width: 768px) {

    h3,
    .h3 {
        font-size: 1.75rem;
    }
}

.lead {
    font-size: 1.25rem;
}

/* --- 2. Navbar --- */
.custom-navbar .nav-link {
    font-size: 1.1rem;
    font-weight: bold;
    transition: color 0.2s ease-in-out;
    text-align: center;
}

.custom-navbar .nav-item {
    border-right: 5px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-navbar .nav-item:first-child {
    border-left: none;
}

.custom-navbar .nav-item:last-child {
    border-right: none;
}

.custom-navbar .nav-link:hover,
.custom-navbar .nav-link.active,
.custom-navbar .nav-item:hover .nav-link,
.custom-navbar .nav-item:focus .nav-link {
    color: #cce5ff !important;
    background-color: #55745a !important;
    width: 100%;
}

.custom-navbar .nav-item:hover,
.custom-navbar .nav-item:focus {
    background-color: #55745a !important;
}

/* --- 3. Dropdown --- */
.custom-dropdown-menu {
    background-color: #a8d08d !important;
    min-width: 100%;
    border-radius: 0 0 8px 8px;
    box-shadow: none;
    padding: 0;
}

.custom-dropdown-item {
    background-color: transparent !important;
    color: #212529 !important;
    font-weight: bold;
    width: 100%;
    padding: 8px 20px;
    border-bottom: 1px solid #fff;
}

.custom-dropdown-menu li:hover,
.custom-dropdown-menu li:focus {
    background-color: #55745A !important;
}

.custom-dropdown-menu li:hover .custom-dropdown-item,
.custom-dropdown-menu li:focus .custom-dropdown-item {
    color: #fff !important;
}

.custom-dropdown-menu li:last-child .custom-dropdown-item {
    border-bottom: none !important;
}

/* --- 4. Navbar Dropdown Arrow Position --- */
.custom-navbar .nav-item.dropdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.custom-navbar .nav-item.dropdown .nav-link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.custom-navbar .nav-item.dropdown .nav-link .fa-chevron-down {
    margin-left: 0.5em;
    position: static;
    transform: none;
    margin-left: auto;
    margin-right: 0;
    font-size: 1em;
    position: relative;
    right: 0;
}

/* --- 5. Project Images --- */
.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin-bottom: 20px;
}

/* --- Top Bar --- */
.top-bar {
    background-color: #333;
    padding: 4px 0;
    font-size: 0.85rem;
}

.top-link {
    color: #fff !important;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.top-link:hover {
    color: #a8d08d !important;
}

/* Fix flag script margin inconsistency in top bar */
.top-links img.me-2 {
    margin-right: 0 !important;
}

.top-separator {
    color: #fff;
    margin: 0 8px;
    opacity: 0.6;
}

.top-bar .dropdown-toggle::after {
    border-top: 0.3em solid #fff;
}

.top-bar .custom-dropdown-menu {
    border-top: 2px solid #55745A !important;
    border-radius: 0 0 4px 4px;
    min-width: 120px;
}

/* --- Banner Styles --- */
.banner-img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .banner-img {
        max-height: 150px;
    }
}

/* --- Card Styles --- */
.card {
    border-radius: 0 !important;
    /* Square card corners */
}

.news-card img {
    height: 300px !important;
    object-fit: cover;
    margin-bottom: 20px;
    border-radius: 0 !important;
}

.history-card {
    border-left: 4px solid #198754;
    /* Green border for emphasis */
    background-color: #f8f9fa;
}

.stat-box {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 100%;
}

.stat-icon {
    font-size: 2.5rem;
    color: #198754;
    margin-bottom: 15px;
}

/* Map Placeholder Style */
.map-placeholder {
    background-color: #e9ecef;
    max-height: 400px;
    border: 2px dashed #ced4da;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.map-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.footer-section {
    background-color: #2c3e50;
    color: white;
    padding-top: 40px;
    padding-bottom: 20px;
}

.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
}

.video-thumbnail-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.video-thumbnail-container .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
    pointer-events: none;
}

.video-thumbnail-container .play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 26px;
    border-color: transparent transparent transparent white;
    margin-left: 5px;
}

.video-thumbnail-container:hover .play-icon {
    background-color: rgba(255, 0, 0, 0.8);
}

/* --- Project Component Specific Styles --- */
:root {
    --primary-green: #2E7D32;
    --accent-green: #66BB6A;
    --dark-bg: #1a2332;
    --light-bg: #f8f9fa;
    --text-dark: #212529;
    /* Menu background color used by navbar/menu items; accordion headers will reference this */
    --menu-bg: #a8d08d;
    /* Active header color when expanded */
    --menu-active: #55745A;
}

/* Enhanced card styling for project components */
.component-card {
    border-radius: 12px !important;
    border: none !important;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
}

.component-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent-green) 0%, #FFD54F 100%);
}

.component-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(46, 125, 50, 0.2);
}

.component-icon {
    color: white;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--primary-green) 100%);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3);
    transition: transform 0.3s ease;
}

.component-card:hover .component-icon {
    transform: scale(1.1) rotate(5deg);
}

.budget-tag {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--accent-green) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.2);
}

.standard-box {
    border: 2px solid var(--accent-green);
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.05) 0%, rgba(46, 125, 50, 0.05) 100%);
    padding: 20px;
    margin-top: 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.standard-box:hover {
    border-color: var(--primary-green);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.1);
}

/* Enhanced list items for project components */
.component-list-item {
    background: linear-gradient(90deg, rgba(102, 187, 106, 0.05) 0%, transparent 100%) !important;
    border-left: 4px solid var(--accent-green) !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    padding: 14px 16px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
}

.component-list-item:hover {
    background: linear-gradient(90deg, rgba(102, 187, 106, 0.12) 0%, rgba(102, 187, 106, 0.05) 100%) !important;
    border-left-color: var(--primary-green) !important;
    transform: translateX(8px) !important;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.12) !important;
    padding-left: 20px !important;
}

.component-list-item i {
    transition: all 0.3s ease;
}

.component-list-item:hover i {
    transform: scale(1.2) rotate(10deg);
}

/* Agency cards for project components */
.agency-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.08) 0%, transparent 100%);
    border-left: 5px solid var(--accent-green);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.agency-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: right 0.6s ease;
}

.agency-card:hover {
    transform: translateX(8px);
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.15) 0%, rgba(102, 187, 106, 0.05) 100%);
    border-left-color: var(--primary-green);
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.15);
}

.agency-card:hover::before {
    right: 100%;
}

.agency-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--primary-green) 100%);
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.2);
    transition: all 0.3s ease;
}

.agency-card:hover .agency-icon {
    transform: scale(1.15) rotate(-10deg);
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.3);
}

.agency-content {
    flex: 1;
    padding-top: 4px;
}

.agency-title {
    margin: 0 0 6px 0;
    color: var(--primary-green);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.agency-text {
    margin: 0;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.agency-card:hover .agency-text {
    color: var(--text-dark);
}

/* Standard metric hover effect */
.standard-metric:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.15);
    border-left-color: var(--primary-green) !important;
}

/* Primary CTA button used across pages */
.btn-cta {
    /* background-color: #2E7D32; */
    color: #000000 !important;
    border-color: #55745A;
    font-size: 1em;
    font-weight: bold;
}

.btn-cta:hover,
.btn-cta:focus {
    /* Slightly darker hover for affordance */
    background-color: #55745A !important;
    border-color: #55745A !important;
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Accordion header to match menu background */
.accordion-button.component-header {
    font-weight: 700;
    background-color: var(--menu-bg) !important;
    color: #000 !important;
    /* default text: bold black */
    border: none !important;
    border-radius: 8px !important;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.15s ease;
}

.accordion-button.component-header:not(.collapsed) {
    /* Use the specified active color when expanded */
    background-color: var(--menu-active) !important;
    color: #fff !important;
    /* active text: white */
}

.accordion-button.component-header small {
    color: rgba(0, 0, 0, 0.85) !important;
    /* muted black for budget text */
    font-weight: 600;
}

.accordion-button.component-header:not(.collapsed) small {
    color: rgba(255, 255, 255, 0.95) !important;
    /* white-ish when active */
}

/* Improved title style for Impact page */
.impact-title {
    color: var(--menu-active);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.4px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;

    padding-bottom: 0.35rem;
    position: relative;
    line-height: 1.15;
}

.impact-title::after {
    content: '';
    display: block;
    width: 64px;
    height: 6px;
    background: linear-gradient(90deg, var(--menu-bg), var(--menu-active));
    border-radius: 4px;
    margin-top: 8px;
}

@media (max-width: 576px) {
    .impact-title {
        font-size: 1.05rem;
    }

    .impact-title::after {
        width: 40px;
        height: 4px;
    }
}

/* --- IMPACT PAGE SPECIFIC STYLES --- */
.stat-card {
    background-color: #f8f9fa;
    border-left: 5px solid #a8d08d;
    padding: 20px;
    height: 100%;
    transition: transform 0.2s;
    border-radius: 0;
    /* Square borders per requirement */
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Image overlay for Impact image */
.impact-image-wrap {
    position: relative;
    overflow: hidden;
}

.impact-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin-bottom: 20px;
}

.image-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30px;
    /* fixed gradient/overlay height */
    padding: 0 20px;
    /* keep horizontal padding, vertical centering handled by flex */
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 0%);
    color: #0933a8;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* center text horizontally */
    text-align: center;
}

/* Text background for the right column */
.impact-text-bg {
    background-color: var(--light-bg);
    padding: 1rem;
    height: 100%;
    display: block;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #55745A;
}

.section-title {
    color: #55745A;
    font-weight: bold;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

/* Small paragraph utility for slightly increased readability */
.line-height-sm {
    line-height: 1.5;
}

/* Larger paragraph line-height utility */
.line-height-2 {
    line-height: 2;
}

.deliverable-box {
    border: 1px solid #dee2e6;
    padding: 20px;
    height: 100%;
    background-color: white;
    border-left: 4px solid #a8d08d;
    /* Accent color */
}

/* --- NEWS PAGE SPECIFIC STYLES --- */
.card {
    border-radius: 0 !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.section-header {
    border-bottom: 2px solid var(--menu-active);
    margin-bottom: 20px;
    padding-bottom: 10px;
    color: var(--menu-active);
    font-weight: bold;
}

/* Sidebar Widgets */
.sidebar-widget {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
}

.widget-title {
    font-weight: bold;
    margin-bottom: 15px;
    border-left: 4px solid var(--menu-active);
    padding-left: 10px;
    color: #333;
}

.event-date {
    font-size: 0.85rem;
    color: var(--menu-active);
    font-weight: bold;
    display: block;
    margin-bottom: 2px;
}

.doc-link {
    color: #495057;
    text-decoration: none;
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    transition: color 0.2s;
}

.doc-link:hover {
    color: var(--menu-active);
    padding-left: 5px;
}

/* Pagination */
.page-link {
    color: var(--menu-active);
    border-radius: 0 !important;
}

.page-item.active .page-link {
    background-color: var(--menu-active);
    border-color: var(--menu-active);
}

/* Override Bootstrap .text-success to use theme color */
.text-success {
    color: var(--menu-active) !important;
}

/* --- Read More Link Hover --- */
.readmore-link:hover,
.readmore-link:focus {
    background-color: var(--menu-active) !important;
    color: #fff !important;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

/* --- Search Button Custom Color --- */
.search-btn {
    background-color: var(--menu-active) !important;
    border-color: var(--menu-active) !important;
    color: #fff !important;
}

.search-btn:hover,
.search-btn:focus {
    background-color: #445c3a !important;
    border-color: #445c3a !important;
    color: #fff !important;
}

.table> :not(caption)>*>* {
    padding: 0.5rem 0.5rem;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* --- Utility Classes for Redesign --- */
.transition-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.transition-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
}

.hover-primary:hover {
    color: var(--menu-active) !important;
}

.last-no-border:last-child {
    border-bottom: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Featured Post Image Responsive Sizing */
.featured-post-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
}

@media (min-width: 768px) {
    .featured-post-img {
        height: 400px;
        aspect-ratio: auto;
    }
}

/* News List Card (Horizontal Layout) */
.news-list-card-img-container {
    width: 100% !important;
    height: auto !important;
    overflow: hidden;
    flex-shrink: 0;
}

.news-list-card-img-container img {
    width: 100% !important;
    height: auto !important;
    display: block;
    object-fit: cover;
}

@media (min-width: 768px) {
    .news-list-card-img-container {
        width: 150px !important;
        height: auto !important;
        min-height: 0;
        flex-basis: 150px;
        flex-grow: 0;
        align-self: flex-start;
        /* Prevent vertical stretching */
    }

    .news-list-card-img-container img {
        width: 150px !important;
        height: auto !important;
        object-fit: contain;
    }
}

/* Card Hover Animation */
.transition-hover {
    transition: all 0.3s ease-in-out;
}

.transition-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .15) !important;
}