/* --- Root Variables for Green Theme Palette --- */
:root {
    /* Primary Green (Deep, professional) */
    --primary-color: #005f33; 
    /* Secondary Green (Brighter, used for accents/buttons) */
    --secondary-color: #2e8b57;
    /* Lighter Green Backgrounds */
    --light-green-bg: #e8f5e9;
    /* Accent Color (Orange from the sun in the logo for contrast CTAs) */
    --accent-color: #f9a825;
    
    --dark-text: #333333;
    --light-text: #666666;
    --white: #ffffff;
    --nav-height: 70px;
}

/* --- Global Reset & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--white);
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--primary-color);
}

a {
    text-decoration: none;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center { text-align: center; }
.hidden { display: none !important; }
.section-padding { padding: 80px 0; }
.bg-light-green { background-color: var(--light-green-bg); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-hero{
    margin: 5px;
    min-width: 300px;
}

.btn-primary {
    background-color: green;
    color: var(--white);
}

.btn-secondary {
    background-color: var(--accent-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-color);
}

.btn-outline {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-large {
    padding: 12px 32px;
    font-size: 1.1rem;
    background-color: green; /* Using orange for main CTA */
}
.btn-large:hover { background-color: #e69500; }

.btn-full { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 0.9rem;}

/* --- Navigation Bar --- */
.navbar {
    height: var(--nav-height);
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    width: 100%;
    top: 0;
    z-index: 100;
    /* display: flex; */
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    height: 100%; /* Allows the container to fill the navbar */
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-logo {
    /* height: 90px; Adjust based on actual logo file */
    max-height: 90%;
    object-fit: contain;
    width: auto;
    display: block;

    min-height: 55px;
    transition: min-height 0.3s ease;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--dark-text);
    font-weight: 600;
    padding: 10px;
}

.nav-link:hover {
    color: var(--secondary-color);
}

.auth-btns {
    display: flex;
    gap: 10px;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Mobile Menu Icon */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.bar {
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    margin-bottom: 4px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    height: 70vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    /* IMPORTANT: Replace hero-bg.jpg with a real image */
    /* background: url('../images/background.jpeg') center/cover no-repeat;  */
    /* Fallback color if image is missing */
    overflow: hidden;
    background-color: var(--primary-color); 
}


/* --- Mid-Page Carousel Styles --- */
.mid-page-carousel {
    position: relative;
    display: grid;
    width: 100%;
    overflow: hidden;
    background-color: #000;
    border-top: 5px solid var(--secondary-color);
    border-bottom: 5px solid var(--secondary-color);
}

.hero-slider {
    /* position: absolute; */
    display: grid;
    grid-template-columns: 1fr;
    /* top: 0;
    left: 0; */
    width: 100%;
    /* height: 100%; */
    /* z-index: 1; */
}

.slide {
    grid-area: 1/1;
    width: 100%;
    height: auto;
    position: relative;
    /* top: 0;
    left: 0; */
    /* background-size: cover; */
    /* background-position: center; */
    opacity: 0;
    transition: opacity 1.5s ease-in-out; /* Smooth fade effect */
}

.slide.active {
    opacity: 1;
    z-index: 2;
    position: relative;
}

.slide img {
    width: 100%;
    height: auto; /* Maintains natural height */
    display: block;
}

/* --- Slide Title/Caption Styling --- */
.slide-caption {
    position: absolute;
    bottom: 30px; /* Spacing from the bottom */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 95, 51, 0.85); /* Semi-transparent Reurja Green */
    color: var(--white);
    padding: 15px 30px;
    border-radius: 4px;
    z-index: 10;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    width: fit-content;
    max-width: 80%;
}

.slide-caption h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--white); /* Overriding the green title color for the caption */
    font-family: 'Montserrat', sans-serif;
}

/* Updated overlay to match dynamic height */
.carousel-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 50, 20, 0.25); 
    z-index: 3; /* Above the images */
    pointer-events: none; /* Allows clicks to pass through if needed */
}

/* Overlay to make text readable over the image */
/* Dark green overlay to ensure text readability over background.jpg */
.hero-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    /* Increased opacity from 0.65 to 0.75 for better contrast */
    background: rgba(0, 30, 15, 0.75);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    color: var(--white);
    padding-left: 5%;
    /* 2. Added Text Shadow to container */
    /* This applies a subtle dark glow behind all text to define edges */
    text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--white);
    font-weight: 700;
    /* Optional: A slightly stronger shadow just for the main headline */
    text-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.hero-content p {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 30px;
    opacity: 1.0;
    /* Optional: A slightly stronger shadow just for the main headline */
    text-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-weight: 600;
}

/* --- Sections Common --- */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
}
.section-lead {
    font-size: 1.2rem;
    color: var(--light-text);
    margin-bottom: 50px;
}

/* --- About Section --- */
.mission-vision-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.mv-card {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-bottom: 4px solid var(--secondary-color);
}

.mv-card h3 {
    margin-bottom: 15px;
}

/* --- Services Section --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding-top: 40px;
}

.service-card {
    background: var(--white);
    padding: 35px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,95,51,0.15);
    border-color: var(--secondary-color);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.service-card h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* --- Footer --- */
.footer {
    background-color: #00331a; /* Very dark green */
    color: rgba(255,255,255,0.8);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    height: 50px;
    margin-bottom: 20px;
    /* Optional: filter to make the logo all white for the footer if needed */
    /* filter: brightness(0) invert(1); */
}

.footer h4 {
    color: var(--white);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
}
.footer-links a:hover { color: var(--accent-color); }

.footer-contact p { margin-bottom: 10px; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    font-size: 0.9rem;
}

/* --- Modals & Forms --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white);
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-text);
}

/* Container to position the spinner inside the input */
.input-wrapper {
    position: relative;
    width: 100%;
}

/* The actual spinner */
.loader {
    display: none; /* Hidden by default */
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-top: 2px solid #9cdb1b; /* Reurja Green */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Class to show the spinner via JS */
.loading .loader {
    display: block;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.form-note {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}
.form-note a { color: var(--secondary-color); }

.account-alert, .submission-error{
    display: none;
    margin-top: 20px;
    font-size: 0.8rem;
    color: #d9534f;
    background: #f9f2f4;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

.submission-error{
    font-weight: 600;
    font-size: 1em;
}

/* This class will be added by PHP if the email exists */
.show-alert {
    display: block !important;
}

/* Laptops & Small Desktops (under 1024px) */
@media screen and (max-width: 1024px) {
    .nav-logo {
        min-height: 50px;
    }
}

/* --- Media Queries for Responsiveness --- */

@media screen and (max-width: 920px) {

    /* .nav-logo{

    } */

    .nav-toggle {
        display: flex; /* Show hamburger on mobile */
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: var(--nav-height);
        flex-direction: column;
        background-color: var(--white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        padding: 20px 0;
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 15px 0;
    }

    .auth-btns {
        flex-direction: column;
        width: 80%;
        margin: auto;
    }

    /* Hamburger animation */
    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Hero text adjustment */
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }

    .slide-caption {
        bottom: 15px;
        padding: 10px 20px;
    }
    .slide-caption h3 {
        font-size: 1.1rem;
    }

    .footer-grid {
        /* Stack elements vertically and center them */
        /* display: flex; */
        /* flex-direction: column; */
        /* align-items: center;
        text-align: center;
        gap: 30px;
        grid-template-columns: 2fr 1fr 1fr 1fr;  */
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-about, 
    .footer-links, 
    .footer-contact {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center; /* Centers items like the logo and lists */
    }

    .footer-links ul {
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .footer-logo {
        margin-left: auto;
        margin-right: auto;
    }
}