/* General Styles */
:root {
    --primary-color: #004a99; /* Dark Blue */
    --secondary-color: #ffd700; /* Gold */
    --accent-color: #007bff; /* Bright Blue */
    --light-grey: #f4f4f4;
    --dark-grey: #333;
    --text-color: #444;
    --white-color: #fff;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Variables */
body.dark-mode {
    --primary-color: #5bb4ff; /* Lighter blue for dark mode headings */
    --secondary-color: #ffd700;
    --accent-color: #7abeff;
    --light-grey: #2a2a2a; /* Dark background */
    --dark-grey: #f0f0f0; /* Light text for dark mode */
    --text-color: #f0f0f0;
    --white-color: #333; /* Darker white for cards etc. */
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Battambang', 'Khmer OS', 'Arial', sans-serif; /* Prioritize Battambang */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-grey); /* Overall background */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 700;
}

/* Header */
header {
    background-color: var(--white-color);
    color: var(--text-color);
    padding: 15px 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.5s ease, color 0.5s ease;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container img {
    height: 40px;
    width: auto;
}

nav .nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav .nav-links li {
    margin-left: 30px;
}

nav .nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

nav .nav-links a:hover,
nav .nav-links a.current {
    color: var(--accent-color);
}

.lang-switcher {
    display: flex;
    margin-left: auto; /* Push to the right of navigation */
    margin-right: 15px; /* Space between lang switcher and dark mode */
}

.lang-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    margin-left: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode .lang-btn {
    border-color: var(--primary-color); /* Maintain distinct border */
    color: var(--primary-color);
}

.lang-btn:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.dark-mode-toggle button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.dark-mode-toggle button:hover {
    color: var(--accent-color);
}

.burger-menu {
    display: none; /* Hidden on desktop */
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-color);
}

/* Mobile Nav Menu */
.mobile-nav-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Hidden by default */
    width: 280px;
    height: 100%;
    background-color: var(--white-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    z-index: 1001;
    transition: right 0.3s ease-in-out;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

body.dark-mode .mobile-nav-menu {
    background-color: var(--dark-grey);
}

.mobile-nav-menu.active {
    right: 0;
}

.mobile-nav-menu .close-btn {
    background: none;
    border: none;
    font-size: 2em;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    color: var(--text-color);
}

.mobile-nav-menu ul {
    list-style: none;
    padding: 40px 0 0 0; /* Space for close button */
}

.mobile-nav-menu ul li {
    margin-bottom: 20px;
}

.mobile-nav-menu ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.2em;
    font-weight: 600;
    display: block;
    padding: 10px 0;
    transition: color 0.3s ease;
}

.mobile-nav-menu ul li a:hover {
    color: var(--accent-color);
}

.mobile-lang-switcher, .mobile-dark-mode-toggle {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.mobile-dark-mode-toggle button {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    color: var(--text-color);
    background: none;
    border: none;
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    background: url('https://via.placeholder.com/1920x800/004a99/ffffff?text=IBMS+Background') no-repeat center center/cover; /* Replace with your actual hero image */
    color: white;
    text-align: center;
    padding: 100px 0;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Ensure no overflow from animations */
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* Overlay for readability */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

#hero-heading, #page-hero h1 {
    font-size: 3.5em; /* Larger for impact */
    margin-bottom: 20px;
    color: var(--white-color); /* Ensure white in hero */
}

#hero-subheading, .hero-subtext {
    font-size: 1.4em;
    margin-bottom: 40px;
    color: var(--white-color); /* Ensure white in hero */
}

.small-hero {
    min-height: 300px;
    padding: 60px 0;
}
.small-hero h1 {
    font-size: 3em;
    margin-bottom: 15px;
}
.small-hero .hero-subtext {
    font-size: 1.2em;
    margin-bottom: 0;
}


/* Buttons */
.button-primary, .button-secondary, .button-tertiary, .button-outline-white {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1.1em;
}

.button-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: 2px solid var(--primary-color);
}

.button-primary:hover {
    background-color: #003a7a; /* Darker shade */
    border-color: #003a7a;
    transform: translateY(-2px); /* Slight lift */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.button-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.button-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

body.dark-mode .button-secondary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

body.dark-mode .button-secondary:hover {
    background-color: var(--primary-color);
    color: #333; /* Darker text for dark mode hover */
}

.button-tertiary {
    background-color: var(--accent-color);
    color: var(--white-color);
    border: 2px solid var(--accent-color);
    font-size: 0.95em; /* Slightly smaller for service cards */
    padding: 8px 18px;
}

.button-tertiary:hover {
    background-color: #0060cb;
    border-color: #0060cb;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.button-outline-white {
    background-color: transparent;
    color: var(--white-color);
    border: 2px solid var(--white-color);
}

.button-outline-white:hover {
    background-color: var(--white-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.large-button {
    padding: 15px 35px; /* Larger padding for hero/CTA buttons */
    font-size: 1.2em;
    border-width: 3px; /* Thicker border for impact */
}

/* Bounce Animation for CTA Button */
.bounce-animation {
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}


/* Section Styles */
section {
    padding: 80px 0;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 25px;
}

/* About Intro */
#about-intro {
    background-color: var(--white-color);
    color: var(--text-color);
}

body.dark-mode #about-intro {
    background-color: var(--dark-grey);
    color: var(--dark-grey); /* Text color set by default body color */
}

/* Services Section */
#services {
    background-color: var(--light-grey);
}

body.dark-mode #services {
    background-color: #222; /* Darker background for services */
}

.service-card {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .service-card {
    background-color: #3a3a3a; /* Darker card background */
    color: var(--dark-grey); /* Light text */
}

body.dark-mode .service-card h3 {
    color: var(--primary-color); /* Lighter primary color for headings */
}

body.dark-mode .service-card p {
    color: var(--dark-grey); /* Ensure paragraph text is light */
}

.service-card img {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 1.7em;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.service-card p {
    font-size: 1.05em;
    margin-bottom: 20px;
    flex-grow: 1; /* Make paragraph take available space */
}

/* Full Services List (services.html) */
.service-detail-card {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
    text-align: center;
}

.service-detail-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .service-detail-card {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}
body.dark-mode .service-detail-card h3 {
    color: var(--primary-color);
}
body.dark-mode .service-detail-card p {
    color: var(--dark-grey);
}

.service-detail-card img {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

/* About Page Specific Styles */
.mission-vision-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .mission-vision-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.mission-vision-item {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
}

body.dark-mode .mission-vision-item {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}
body.dark-mode .mission-vision-item h2 {
    color: var(--primary-color);
}
body.dark-mode .mission-vision-item p {
    color: var(--dark-grey);
}

.mission-vision-item h2 {
    font-size: 2em;
    margin-bottom: 15px;
    text-align: center;
}
.mission-vision-item p {
    font-size: 1.1em;
    line-height: 1.8;
}

.our-values .values-list li {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 180px;
}
.our-values .values-list li:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
body.dark-mode .our-values .values-list li {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}
body.dark-mode .our-values .values-list li h3 {
    color: var(--primary-color);
}

/* Contact Page Specific Styles */
#contact-form .max-w-xl { /* Tailwind max-w-xl is 36rem */
    margin-left: auto;
    margin-right: auto;
    max-width: 36rem; /* Equivalent to Tailwind's max-w-xl */
}
#contact-form .bg-gray-100 {
    background-color: var(--light-grey);
}
body.dark-mode #contact-form .bg-gray-100 {
    background-color: #3a3a3a;
}
#contact-form .p-8 {
    padding: 2rem; /* Tailwind p-8 */
}
#contact-form .rounded-2xl {
    border-radius: 1rem; /* Tailwind rounded-2xl */
}
#contact-form .shadow {
    box-shadow: var(--box-shadow);
}
#contact-form .space-y-6 > * + * {
    margin-top: 1.5rem; /* Tailwind space-y-6 */
}
#contact-form label {
    display: block;
    font-weight: 600; /* font-medium */
    margin-bottom: 0.25rem; /* mb-1 */
    font-size: 1.125rem; /* text-lg */
    color: var(--text-color);
}
#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form input[type="tel"],
#contact-form textarea {
    width: 100%;
    padding: 0.75rem; /* p-3 */
    border: 1px solid var(--dark-grey); /* border border-gray-300 */
    border-radius: 0.5rem; /* rounded-lg */
    background-color: var(--white-color); /* bg-white */
    color: var(--text-color); /* text-gray-900 */
    transition: all 0.3s ease;
}
body.dark-mode #contact-form input,
body.dark-mode #contact-form textarea {
    background-color: #2a2a2a; /* dark:bg-gray-700 */
    border-color: var(--dark-grey); /* dark:border-gray-600 */
    color: var(--dark-grey); /* dark:text-white */
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color); /* focus:ring-2 focus:ring-blue-500 */
    border-color: var(--accent-color);
}

#contact-form .button-primary {
    width: 100%;
}

.info-card {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
}
body.dark-mode .info-card {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}
body.dark-mode .info-card h3 {
    color: var(--primary-color);
}
body.dark-mode .info-card p {
    color: var(--dark-grey);
}

.info-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.info-card i {
    color: var(--accent-color);
}
.info-card p a {
    color: var(--accent-color);
    text-decoration: none;
}
.info-card p a:hover {
    text-decoration: underline;
}

#map-location iframe {
    border: 1px solid var(--dark-grey);
    box-shadow: var(--box-shadow);
}
body.dark-mode #map-location iframe {
    border-color: var(--dark-grey);
}


/* Testimonials Section */
#testimonials {
    background-color: var(--white-color);
    color: var(--text-color);
}

body.dark-mode #testimonials {
    background-color: var(--dark-grey);
}

.testimonial-item {
    background-color: var(--light-grey);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px; /* Ensure consistent height */
}

.testimonial-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .testimonial-item {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}

body.dark-mode .testimonial-item p {
    color: var(--dark-grey);
}

.testimonial-item p.italic {
    font-style: italic;
    margin-bottom: 15px;
    font-size: 1.05em;
}

.testimonial-item p.font-semibold {
    font-weight: 600;
    color: var(--primary-color);
}


/* CTA Section */
#cta, #services-cta, #about-cta {
    background-color: var(--primary-color);
    color: var(--white-color);
    text-align: center;
    padding: 60px 0;
}

body.dark-mode #cta, body.dark-mode #services-cta, body.dark-mode #about-cta {
    background-color: #002e5c; /* Slightly darker primary in dark mode */
}

#cta h2, #services-cta h2, #about-cta h2 {
    color: var(--white-color);
}

#cta p, #services-cta p, #about-cta p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.15em;
}

/* Latest News Section (Blog Preview) and Blog Posts Page */
#latest-news, #blog-posts {
    background-color: var(--light-grey);
}

body.dark-mode #latest-news, body.dark-mode #blog-posts {
    background-color: #222;
}

.news-item {
    background-color: var(--white-color);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.news-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .news-item {
    background-color: #3a3a3a;
    color: var(--dark-grey);
}

body.dark-mode .news-item h3 {
    color: var(--primary-color);
}

body.dark-mode .news-item p {
    color: var(--dark-grey);
}

.news-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.news-item h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    flex-grow: 1; /* Allow heading to take space */
}

.news-item p {
    font-size: 1em;
    color: var(--text-color);
    margin-bottom: 15px;
}


/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 40px 0 20px;
    margin-top: auto; /* Pushes footer to the bottom */
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.dark-mode footer {
    background-color: #002e5c; /* Darker primary in dark mode */
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

footer h3 {
    color: var(--white-color);
    font-size: 1.4em;
    margin-bottom: 15px;
}

footer p {
    font-size: 0.95em;
    line-height: 1.8;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary-color);
}

.footer-links ul {
    list-style: none;
    padding: 0;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-social .social-icons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.footer-social .social-icons a {
    color: var(--white-color);
    font-size: 1.8em;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-social .social-icons a:hover {
    color: var(--secondary-color);
    transform: translateY(-3px);
}

.footer-copyright {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
}


/* Animation for sections (Fade-in and Scale) */
.animate-on-scroll {
    opacity: 0;
    transform: scale(0.95); /* Start slightly smaller */
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: scale(1);
}


/* Responsive Design */
@media (max-width: 992px) {
    nav .nav-links {
        display: none; /* Hide desktop nav */
    }

    .burger-menu {
        display: block; /* Show burger on tablet/mobile */
    }

    .lang-switcher, .dark-mode-toggle {
        display: none; /* Hide desktop lang and dark mode toggle */
    }

    .hero-section {
        padding: 80px 0;
    }

    #hero-heading, #page-hero h1 {
        font-size: 2.8em;
    }
    #hero-subheading, .hero-subtext {
        font-size: 1.2em;
    }

    h2 {
        font-size: 2em;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .footer-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        text-align: center;
    }

    .footer-social .social-icons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    header .container {
        padding: 0 15px;
    }

    .hero-section {
        min-height: 400px;
        padding: 60px 0;
    }
    .small-hero {
        min-height: 250px;
        padding: 40px 0;
    }

    #hero-heading, #page-hero h1 {
        font-size: 2.2em;
    }

    #hero-subheading, .hero-subtext {
        font-size: 1em;
    }

    .button-primary, .button-secondary, .button-tertiary, .button-outline-white {
        font-size: 1em;
        padding: 10px 20px;
    }
    .large-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }

    h2 {
        font-size: 1.8em;
    }
    h3 {
        font-size: 1.4em;
    }

    .service-card h3, .testimonial-item p.font-semibold, .news-item h3, .service-detail-card h3 {
        font-size: 1.3em;
    }

    .service-card p, .testimonial-item p.italic, .news-item p, #about-intro p, #cta p,
    .mission-vision-item p, .our-values ul li, .service-detail-card p {
        font-size: 0.95em;
    }

    .service-card img, .service-detail-card img {
        width: 70px;
        height: 70px;
    }

    footer h3 {
        font-size: 1.2em;
    }
    footer p, footer a {
        font-size: 0.85em;
    }
    .social-icons {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    #hero-heading, #page-hero h1 {
        font-size: 1.8em;
    }
    #hero-subheading, .hero-subtext {
        font-size: 0.9em;
    }
    .large-button {
        padding: 10px 25px;
        font-size: 1em;
    }
    h2 { font-size: 1.5em; }
    h3 { font-size: 1.2em; }

    section {
        padding: 50px 0;
    }

    .service-card, .testimonial-item, .news-item, .service-detail-card,
    .mission-vision-item, .our-values .values-list li, .info-card {
        padding: 20px;
    }

    .news-item img {
        height: 150px;
    }

    .info-card i {
        font-size: 3em;
    }
}