@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Premium Agricultural Palette */
    --primary: #1B5E20;
    --primary-light: #4CAF50;
    --primary-accent: #2E7D32;
    --primary-glow: rgba(27, 94, 32, 0.4);

    --bg-light: #F8FAF8;
    --bg-white: #FFFFFF;
    --bg-gradient: linear-gradient(135deg, #F8FAF8 0%, #F0F4F0 100%);

    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(27, 94, 32, 0.1);
    --card-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);

    --text-primary: #1A2E1C;
    --text-secondary: #4A5D4C;
    --text-muted: #809683;

    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --success-bg: rgba(76, 175, 80, 0.1);
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger-bg: rgba(239, 68, 68, 0.1);

    --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Premium Interactive Enhancements --- */

.feature-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease,
        border-color 0.4s ease !important;
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(27, 94, 32, 0.08);
    border-color: var(--primary-light) !important;
}

.cta-button {
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    position: relative;
    overflow: hidden;
}

.cta-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.cta-button:hover::after {
    opacity: 1;
}

.cta-button:hover {
    box-shadow: 0 0 20px var(--primary-glow), 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-3px);
}

/* Animated Progress Bars */
.progress-bar-fill {
    width: 0;
    transition: width 1.5s cubic-bezier(0.1, 0, 0.2, 1);
}

/* Hero Gradient Backdrop */
.hero-gradient-animate {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(76, 175, 80, 0.03) 0%, transparent 50%);
    animation: slowRotate 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes slowRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Background Accents - Subtler for Light Theme */
.blob,
.blob-2 {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(102, 187, 106, 0.05) 0%, transparent 70%);
    z-index: -1;
    border-radius: 50%;
}

.blob {
    top: -200px;
    right: -200px;
}

.blob-2 {
    bottom: -200px;
    left: -200px;
}

/* Dashboard Layout */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    padding: 40px 24px;
    z-index: 100;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--success-bg);
    color: var(--primary);
    font-weight: 700;
    border-left: 4px solid var(--primary);
}

.main-wrapper {
    margin-left: 280px;
    padding: 40px 60px;
    min-height: 100vh;
    overflow-y: auto;
}

/* Glass Panel -> Standard Card */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    border-radius: 20px;
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    box-shadow: var(--shadow-medium);
}

/* Operational Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.metric-card {
    padding: 24px;
    border-left: 4px solid var(--primary);
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 10px 0;
}

/* Heatmap & Tiles */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-top: 25px;
}

.zone-tile {
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.zone-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.zone-safe {
    background: var(--success-bg);
    border-color: #C8E6C9;
}

.zone-warning {
    background: var(--warning-bg);
    border-color: #FFF9C4;
}

.zone-critical {
    background: var(--danger-bg);
    border-color: #FFCDD2;
    animation: emergencyPulse 2s infinite;
}

@keyframes emergencyPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.2);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(211, 47, 47, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

.zone-name {
    font-weight: 700;
    color: var(--text-primary);
}

.zone-temp {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 5px 0;
    color: var(--text-primary);
}

/* AI Decision Center */
.decision-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}

.urgent-glow {
    border-left-color: var(--danger);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.1) !important;
}

/* Status Badges */
.badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Premium Buttons */
.btn-premium {
    background: var(--primary);
    color: white;
    padding: 16px 28px;
    /* Slightly larger for premium feel */
    border-radius: 15px;
    border: none;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-premium:hover {
    background: var(--primary-accent);
    box-shadow: 0 0 20px var(--primary-glow), 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    padding: 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-medium);
}

/* AI Insight Bar */
.ai-insight-bar {
    display: flex;
    align-items: center;
    background: var(--success-bg);
    border: 1px solid #C8E6C9;
    border-radius: 12px;
    padding: 12px 24px;
    margin-bottom: 30px;
    gap: 20px;
    color: var(--primary);
}

.insight-item {
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Timeline Components */
.timeline-stage {
    position: relative;
    padding-left: 40px;
    margin-bottom: 30px;
}

.timeline-stage::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: -30px;
    width: 2px;
    background: var(--card-border);
}

.timeline-stage:last-child::before {
    display: none;
}

.stage-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    z-index: 2;
}

/* Tables - Farmer Friendly */
.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    padding: 16px;
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--bg-light);
}

.premium-table td {
    padding: 20px 16px;
    border-bottom: 1px solid var(--bg-light);
}

.premium-table tr:nth-child(even) {
    background: #fafafa;
}

.premium-table tr:hover {
    background: var(--bg-light);
}

/* Farmer Panel */
.farmer-panel {
    background: var(--bg-light);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: 20px;
    margin-top: 30px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 40px 0;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 900px;
    padding: 40px;
    border-radius: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* Priority Status Colors */
.priority-high {
    background: #FED7D7;
    color: #C53030;
}

.priority-medium {
    background: #FEEBC8;
    color: #975A16;
}

.priority-low {
    background: #C6F6D5;
    color: #276749;
}

.priority-pending {
    background: #E2E8F0;
    color: #64748B;
}

/* Filter Controls */
.filter-select {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: white;
    color: var(--text-primary);
    outline: none;
}

/* --- Landing Page Enhancements --- */

/* Animations */
@keyframes floating {
    0% {
        transform: translateY(0px);
    }

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

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

@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slowRoll {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 1000px 1000px;
    }
}

/* Gradient Text Emphasis */
.gradient-text {
    background: linear-gradient(120deg, var(--primary), #10b981, var(--primary), #43A047);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Compatibility fix */
    animation: gradientText 8s ease infinite;
    font-weight: 900;
}

/* Hero Section Layout */
.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 140px 60px 80px;
    /* Reduced top gap for tighter fit */
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1.2;
    max-width: 800px;
    text-align: left !important;
}

.hero-visual {
    flex: 0.9;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}

/* UI Mockup Components */
.mockup-container {
    position: relative;
    width: 100%;
    max-width: 620px;
    height: 480px;
    background: white;
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(27, 94, 32, 0.1);
    border-radius: 40px;
    box-shadow:
        0 40px 100px -20px rgba(0, 0, 0, 0.15),
        0 18px 36px -18px rgba(0, 0, 0, 0.05);
    animation: floating 8s ease-in-out infinite;
    overflow: hidden;
    /* Ensure image background doesn't bleed */
}

.floating-card {
    position: absolute;
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
    transition: var(--transition-smooth);
}

.floating-card:hover {
    transform: scale(1.05) translateX(10px);
}

.card-1 {
    top: 15%;
    right: -40px;
    animation: floating 5s ease-in-out infinite 0.5s;
}

.card-2 {
    bottom: 20%;
    left: -60px;
    animation: floating 7s ease-in-out infinite 1s;
}

.card-3 {
    top: 50%;
    right: -20px;
    animation: floating 6s ease-in-out infinite 1.5s;
}

/* Credibility Strip */
.credibility-strip {
    background: white;
    padding: 40px 0;
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    position: relative;
    z-index: 2;
}

.strip-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 45px;
    height: 45px;
    background: var(--success-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
}

.stat-text {
    line-height: 1.2;
}

.stat-number {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Enhanced Buttons */
.btn-primary-glow {
    position: relative;
    overflow: hidden;
}

.btn-primary-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary-glow:hover::after {
    opacity: 1;
}

.btn-outline-ghost {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 18px 40px;
    /* Matched to cta-button */
    border-radius: 50px;
    font-weight: 800;
    text-decoration: none;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.btn-outline-ghost:hover {
    background: var(--primary);
    color: white !important;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(46, 125, 50, 0.2);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
    transition: 0.3s;
}

.scroll-indicator:hover {
    opacity: 1;
    color: var(--primary);
}

.scroll-dot {
    width: 2px;
    height: 40px;
    background: var(--card-border);
    position: relative;
    overflow: hidden;
}

.scroll-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: var(--primary);
    animation: scrollMove 2s infinite;
}

@keyframes scrollMove {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(200%);
    }
}

/* Background Grain and Mesh */
.bg-subtle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(at 0% 0%, rgba(76, 175, 80, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(27, 94, 32, 0.02) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(76, 175, 80, 0.05) 0px, transparent 50%);
}

.bg-dot-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image: radial-gradient(#1B5E20 0.8px, transparent 0.8px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse at center, white, transparent 80%);
}

.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://grains.vercel.app/grain.png");
    opacity: 0.03;
    z-index: 1000;
    pointer-events: none;
}

/* --- Responsive Design --- */

/* Tablet & Smaller Laptops */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 40px 10px;
        transition: var(--transition-smooth);
    }

    .sidebar .brand div:last-child,
    .sidebar .nav-item span,
    .sidebar .farmer-panel {
        display: none;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 15px;
    }

    .sidebar .nav-item i {
        margin: 0;
        font-size: 1.5rem;
    }

    .main-wrapper {
        margin-left: 80px;
        padding: 30px;
    }

    .hero-container {
        flex-direction: column;
        padding: 120px 30px 60px;
        text-align: center;
    }

    .hero-content {
        text-align: center !important;
        margin-bottom: 50px;
    }

    .hero-content p {
        margin: 0 auto 40px;
    }

    .hero-content div {
        justify-content: center;
    }

    .hero-visual {
        padding-left: 0;
        justify-content: center;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .heatmap-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    header {
        padding: 15px 20px !important;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    header nav {
        display: none !important;
        /* Hide nav links on mobile for index.html */
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar .brand div:last-child,
    .sidebar .nav-item span,
    .sidebar .farmer-panel {
        display: block;
    }

    .sidebar .nav-item {
        justify-content: flex-start;
    }

    .main-wrapper {
        margin-left: 0 !important;
        padding: 20px !important;
    }

    .hero-content h1 {
        font-size: 3rem !important;
    }

    .metrics-grid,
    .impact-grid,
    .analytics-grid,
    .trace-header-grid,
    .trace-main-grid,
    .inventory-hero,
    .inventory-filter-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        /* Increased slightly for better separation */
    }

    .ai-assistant-panel {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .insight-stats {
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }

    .heatmap-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-wrapper section:first-of-type {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 20px;
    }

    .main-wrapper section div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .main-wrapper>div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    #credibility .strip-container {
        flex-wrap: wrap;
        gap: 30px;
        justify-content: center;
    }

    #credibility div[style*="width: 1px"] {
        display: none;
    }

    #features div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    section[style*="padding: 120px 60px"] {
        padding: 50px 20px !important;
        /* Slightly more compact for mobile */
    }

    section[style*="display: flex"] {
        flex-direction: column !important;
        gap: 40px !important;
    }

    .mockup-container {
        height: 350px;
    }

    .floating-card {
        padding: 10px 15px;
        font-size: 0.8rem;
    }

    .card-1 {
        right: -10px;
        top: 5%;
    }

    .card-2 {
        left: -10px;
        bottom: 10%;
    }

    .card-3 {
        right: -5px;
        top: 40%;
    }

    #chatbot-window {
        width: 90vw;
        max-width: 350px;
        height: 500px;
        bottom: 85px;
        right: 0;
    }

    #chatbot-bubble {
        bottom: 20px;
        right: 20px;
    }
}

/* Very Small Devices */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2.2rem !important;
    }

    .hero-content p {
        font-size: 1rem !important;
    }

    .cta-button {
        padding: 12px 24px !important;
        font-size: 0.9rem !important;
        width: 100%;
        justify-content: center;
    }

    .btn-outline-ghost {
        width: 100%;
        justify-content: center;
    }

    .hero-content div[style*="display: flex"] {
        flex-direction: column;
        width: 100%;
    }

    .heatmap-grid {
        grid-template-columns: 1fr;
    }

    .premium-table {
        display: block;
        overflow-x: auto;
    }

    .modal-content {
        padding: 20px;
    }
}

/* Utility classes for mobile toggle */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    border: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--primary-glow);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
}