:root {
    --primary-color: #2c3e50;
    --secondary-color: #27ae60;
    --accent-color: #e67e22;
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(#dee2e6 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-color);
    margin: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* Sidebar Container */
.sidebar {
    width: var(--sidebar-collapsed-width);
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-right: none;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.5rem;
    /* Compact padding */
    position: fixed;
    height: 100%;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Smooth expansion */
    overflow: hidden;
    white-space: nowrap;
}

.sidebar:hover {
    width: var(--sidebar-width);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
}

/* Header Animation */
.sidebar-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-icon {
    font-size: 1.8rem;
    color: var(--secondary-color);
    transition: all 0.4s ease;
    position: absolute;
    opacity: 1;
    transform: scale(1);
}

.sidebar:hover .header-icon {
    opacity: 0;
    transform: scale(0.5);
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ecf0f1;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    position: absolute;
}

.sidebar:hover .brand-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

/* Nav Link Animation */
.nav-link {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    color: #bdc3c7;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    justify-content: center;
    /* Center icon initially */
}

/* Hover Effects ("Horror" -> "Hover" enhanced) */
.nav-link:hover {
    background-color: var(--secondary-color);
    color: #fff;
    transform: translateX(5px);
    /* Reduced slide for tighter feel */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
    /* Ensure full width */
    border-radius: 4px;
    /* Less rounded for "whole" feel */
}

.nav-link i {
    font-size: 1.4rem;
    min-width: 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Bouncy exit */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
}

.sidebar:hover .nav-link i {
    opacity: 0;
    transform: translateX(-50px) scale(0.5);
    /* Fly out to left */
}

.link-text {
    font-weight: 500;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease;
    position: absolute;
    left: 20px;
    white-space: nowrap;
}

.sidebar:hover .link-text {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
    /* Slight delay for stagger effect */
}

.nav-link.active i {
    color: var(--secondary-color);
}

.nav-link.active .link-text {
    color: var(--secondary-color);
}

/* ... existing code ... */

/* Main Content */
.main-content {
    flex: 1;
    margin-left: calc(var(--sidebar-collapsed-width) + 2rem);
    /* Added gap between sidebar and content */
    padding: 2rem;
    /* Extra padding for balance */
    max-width: 1600px;
    /* Optional constraint for ultra-wide screens */
}

/* Landing Page Specifics (overrides sidebar for full width) */
body.landing-page {
    display: block; /* Disable flexbox for landing page to allow standard section stacking */
}

body.landing-page .sidebar {
    display: none;
}

body.landing-page .main-content {
    margin-left: 0;
    padding: 0;
    display: block;
}

/* Navigation for Landing */
.landing-nav {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.landing-nav .logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-items a {
    text-decoration: none;
    color: var(--text-color);
    margin-left: 2rem;
    font-weight: 500;
}

.cta-button {
    background-color: var(--secondary-color);
    color: white !important;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    text-decoration: none !important;
    /* Remove underline */
    display: inline-block;
    /* Ensure proper spacing */
}

/* Hero Section */
.hero {
    padding: 6rem 2rem;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4rem;
}

.hero-text {
    max-width: 600px;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.hero p {
    font-size: 1.25rem;
    color: #555;
    margin-bottom: 2rem;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Smooth hover transition */
}

.card:hover {
    transform: translateY(-8px);
    /* Lift up */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    /* Deep shadow */
    border-color: var(--secondary-color);
    /* Subtle border highlight */
}

.card h3 {
    margin-top: 0;
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.severity-Critical {
    color: #e74c3c !important;
}

.severity-High {
    color: #e67e22 !important;
}

.severity-Moderate {
    color: #f1c40f !important;
}

.severity-Low {
    color: #27ae60 !important;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f1f3f5;
    font-weight: 600;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.image-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.image-info {
    padding: 1rem;
}

/* Pipeline Items */
.pipeline-item {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    text-align: center;
}

.pipeline-item img {
    width: 100%;
    height: auto;
    max-height: 200px;
    /* Constrain height */
    object-fit: contain;
    /* Ensure image fits */
    border-radius: 4px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hero-image img {
    max-width: 100%;
    height: auto;
    max-height: 350px;
    /* Constrain hero image height */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 4rem 1rem;
        /* Reduce padding on mobile */
    }

    .hero-image {
        width: 100%;
        /* Ensure container takes full width */
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.card {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Scroll Animation Utilities */
.scroll-hidden {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.scroll-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Delays */
.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

.delay-300 {
    transition-delay: 0.3s;
}

.delay-400 {
    transition-delay: 0.4s;
}

.hero-image img,
.pipeline-item img {
    animation: float 6s ease-in-out infinite;
}

.stats-grid .card:nth-child(1) {
    animation-delay: 0.1s;
}

.stats-grid .card:nth-child(2) {
    animation-delay: 0.2s;
}

.stats-grid .card:nth-child(3) {
    animation-delay: 0.3s;
}

.stats-grid .card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Elevate landing page content above the background canvas (z-index 1) */
.hero-text,
.hero-image,
.pipeline-item,
#features>div,
#contact>div,
#contact h2,
#pipeline h2,
.landing-nav {
    position: relative;
    z-index: 5;
}

/* Ensure form inputs are clickable */
form {
    position: relative;
    z-index: 6;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.stats-grid .card .value {
    color: #2c3e50;
    font-weight: 800;
}

/* Flatter cards with softer shadows */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    /* More rounded */
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    /* Softer hover lift */
}

/* Cleaner buttons */
.cta-button {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 6px rgba(39, 174, 96, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(39, 174, 96, 0.3);
}

/* Chart container cleanup */
#pestTrendChart {
    margin-top: 1rem;
}