/* ====================================
   Leafline Nexus - Main Stylesheet
   Modern, Minimal, Fast-Loading
   ==================================== */

/* === CSS Variables === */
:root {
    --primary-green: #2D5F3F;
    --secondary-green: #4CAF50;
    --accent-blue: #1976D2;
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #F5F5F5;
    --white: #FFFFFF;
    --shadow: rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* === Reset & Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--white);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary-green);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Utility Classes === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.section-title p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary-green);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--secondary-green);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn-secondary {
    background: var(--accent-blue);
    color: var(--white);
}

.btn-secondary:hover {
    background: #1565C0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn-outline {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

.btn-outline:hover {
    background: var(--primary-green);
    color: var(--white);
}

.btn-white {
    background: var(--white);
    color: var(--primary-green);
    border: 2px solid var(--white);
}

.btn-white:hover {
    background: transparent;
    color: var(--white);
    border-color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* === Header Styles === */
header {
    background: var(--white);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo img {
    height: 50px;
    width: auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-menu a {
    font-weight: 500;
    color: var(--text-dark);
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-green);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-green);
    transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

/* Prevent underline on button links */
.nav-menu a.btn::after,
.nav-menu a.btn-primary::after {
    display: none !important;
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.mobile-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary-green);
    border-radius: 3px;
    transition: var(--transition);
}

/* Mobile toggle active state - transform to X */
.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* === Hero Section === */
.hero {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: var(--white);
    padding: 120px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M1200 120L0 16.48V0h1200v120z" fill="%23ffffff" fill-opacity="0.1"/></svg>') bottom center no-repeat;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

.hero h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.95;
    animation: fadeInUp 0.8s ease 0.2s;
    animation-fill-mode: backwards;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease 0.4s;
    animation-fill-mode: backwards;
}

/* === Stats Section === */
.stats {
    background: var(--bg-light);
    padding: 60px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    text-align: center;
}

.stat-item {
    background: var(--white);
    padding: 30px 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px var(--shadow);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px var(--shadow);
}

.stat-item i {
    font-size: 3rem;
    color: var(--primary-green);
    margin-bottom: 15px;
    display: block;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-light);
    font-size: 1rem;
}

/* === Services Grid === */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 10px;
    box-shadow: 0 3px 15px var(--shadow);
    transition: var(--transition);
    text-align: center;
    border-top: 4px solid var(--primary-green);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow);
}

.service-icon {
    font-size: 3rem;
    color: var(--secondary-green);
    margin-bottom: 20px;
}

.service-card h3 {
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-light);
    margin-bottom: 0;
}

/* === Why Choose Us === */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: var(--transition);
}

.feature-item:hover {
    background: var(--white);
    box-shadow: 0 5px 15px var(--shadow);
}

.feature-icon {
    font-size: 2rem;
    color: var(--primary-green);
    flex-shrink: 0;
}

.feature-content h4 {
    margin-bottom: 10px;
}

.feature-content p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* === Team Grid === */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.team-member {
    text-align: center;
    transition: var(--transition);
}

.team-member:hover {
    transform: translateY(-10px);
}

.team-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 4px solid var(--primary-green);
    background: var(--bg-light);
}

.team-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-member h3 {
    margin-bottom: 5px;
}

.team-role {
    color: var(--secondary-green);
    font-weight: 600;
    margin-bottom: 10px;
}

.team-bio {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* === Job Listings === */
.job-search {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 40px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.search-form input,
.search-form select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: var(--primary-green);
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.job-card {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 3px 10px var(--shadow);
    transition: var(--transition);
    border-left: 4px solid var(--primary-green);
}

.job-card:hover {
    box-shadow: 0 5px 20px var(--shadow);
    transform: translateX(5px);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.job-title {
    margin-bottom: 5px;
}

.job-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    color: var(--text-light);
    font-size: 0.9rem;
}

.job-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.job-description {
    color: var(--text-light);
    margin: 15px 0;
}

.job-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tag {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* === Contact Form === */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.contact-item {
    display: flex;
    gap: 20px;
}

.contact-icon {
    font-size: 1.5rem;
    color: var(--primary-green);
    flex-shrink: 0;
}

.contact-details h4 {
    margin-bottom: 5px;
}

.contact-details p {
    color: var(--text-light);
    margin-bottom: 0;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(45, 95, 63, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-message {
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* === Footer === */
footer {
    background: var(--primary-green);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 20px;
}

.footer-section p {
    opacity: 0.9;
    line-height: 1.8;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    color: var(--white);
    opacity: 0.9;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--secondary-green);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.8;
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Loading Spinner === */
.spinner {
    border: 3px solid var(--bg-light);
    border-top: 3px solid var(--primary-green);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === Responsive Design === */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }

    .section { padding: 50px 0; }

    .navbar {
        position: relative;
    }

    .mobile-toggle {
        display: flex;
    }

    /* FIX: Properly hide mobile navigation with opacity and visibility */
    .nav-menu {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 0;
        box-shadow: 0 5px 10px var(--shadow);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease, padding 0.3s ease;
        opacity: 0;
        visibility: hidden;
        z-index: 999;
    }

    /* FIX: Show navigation when active */
    .nav-menu.active {
        max-height: 100vh;
        padding: 20px 0;
        opacity: 1;
        visibility: visible;
    }

    /* FIX: Ensure Contact Us button has white text in mobile menu */
    .nav-menu .btn-primary,
    .nav-menu a.btn-primary {
        color: var(--white) !important;
    }

    .nav-menu .btn-primary:hover,
    .nav-menu a.btn-primary:hover {
        color: var(--white) !important;
    }

    .hero {
        padding: 80px 0 60px;
        text-align: center;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
        display: flex;
        flex-direction: column;
    }

    /* Form appears first on mobile */
    .contact-form-wrapper {
        order: 1;
    }

    /* Info appears second on mobile */
    .contact-info {
        order: 2;
    }

    .search-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }
}

/* ADDITIONAL FIX: Ensure button contrast in desktop navigation too */
.nav-menu .btn-primary {
    color: var(--white) !important;
    background: var(--primary-green);
}

.nav-menu .btn-primary:hover {
    color: var(--white) !important;
    background: var(--secondary-green);
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }
}

/* === Print Styles === */
@media print {
    header,
    footer,
    .hero-buttons,
    .btn {
        display: none;
    }
}