/* =========================================
   1. DESKTOP STYLES (DEFAULT)
   ========================================= */

/* Navbar Container Styling */
.navbar {
    height: 100px; 
    /* Added Micro-Texture: SVG Noise blended with semi-transparent white */
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 100%; 
    width: 100%; 
    padding-left: 40px; 
    padding-right: 0; 
    margin: 0;
    display: flex;
    justify-content: space-between; 
    align-items: center;
    height: 100%;
}

/* Logo and Brand Text */
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 15px;
    flex-shrink: 0; 
    user-select: none; 
    -webkit-user-select: none; 
}

.logo-img {
    height: 55px; 
    width: auto;
    padding-left: 80px;
    -webkit-user-drag: none; 
    pointer-events: none; 
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: #2E7D32; 
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

/* Main Navigation Links (Desktop) */
.nav-links {
    display: flex;
    list-style: none;
    gap: 40px; 
    align-items: center;
    margin-left: auto; 
}

.nav-links li a {
    text-decoration: none;
    color: #37474F;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    display: flex; 
    align-items: center; 
}

.nav-links li a:hover {
    color: #2E7D32; 
}

/* Hide Hamburger on Desktop */
.hamburger-menu {
    display: none;
}

/* Dropdown Parent Logic */
.dropdown {
    position: relative;
}

/* Smooth Dropdown Animation */
.dropdown-content {
    display: block; 
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.95);
    transform-origin: top center; 
    background: rgba(255, 255, 255, 0.98); 
    backdrop-filter: blur(12px); 
    min-width: 220px;
    padding: 15px 0;
    list-style: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    border-top: 4px solid #2E7D32;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
    z-index: 1001;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.dropdown-content li {
    padding: 0 10px;
}

.dropdown-content li a {
    padding: 12px 15px;
    display: block;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.dropdown-content li a:hover {
    background-color: #E8F5E9;
    color: #2E7D32;
    padding-left: 22px; 
}

/* Desktop Rotating Arrow Indicator */
.dropbtn::after {
    content: '▾';
    font-size: 1.1rem;
    margin-left: 6px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: transform 0.3s ease, color 0.3s ease;
    background: transparent; 
}

.dropdown:hover .dropbtn::after {
    transform: rotate(180deg);
    color: #2E7D32;
}

/* =========================================
   2. TABLET RESPONSIVENESS (993px - 1200px)
   ========================================= */
@media (max-width: 1200px) {
    .navbar {
        height: 100px;
    }
    
    .logo-img {
        height: 55px; 
    }
    
    .logo-text {
        font-size: 2rem; 
    }

    .nav-links {
        gap: 20px; 
    }

    .nav-links li a {
        font-size: 0.9rem; 
    }
}

/* =========================================
   3. MOBILE RESPONSIVENESS (< 992px)
   ========================================= */
@media (max-width: 992px) {
    
    /* Shrink Navbar & FORCE it to stay locked at the top */
    .navbar { 
        height: 80px; 
        position: fixed !important; 
        top: 0 !important; 
        left: 0;
        width: 100%;
        z-index: 9999 !important; 
        /* Added Micro-Texture for Mobile Navbar */
        background-color: rgba(255, 255, 255, 0.92);
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px); 
    }

    .logo-img { height: 45px; padding-left: 0px; }
    .logo-text { font-size: 1.6rem; }

    /* 1. Hamburger Icon Logic */
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 32px;
        cursor: pointer;
        z-index: 2000;
        margin-right: 20px;
    }

    .hamburger-menu input { display: none; }

    .hamburger-menu .bar {
        height: 3px;
        width: 100%;
        background-color: #2E7D32; 
        border-radius: 16px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    }

    .hamburger-menu input:checked ~ .bar-top { transform: translateY(9px) rotate(45deg); }
    .hamburger-menu input:checked ~ .bar-mid { opacity: 0; transform: scale(0.5); }
    .hamburger-menu input:checked ~ .bar-bot { transform: translateY(-9px) rotate(-45deg); }

    /* 2. "Floating Glass Island" Overlay */
    .nav-links {
        position: fixed;
        top: 90px; 
        right: -120%; 
        width: calc(100vw - 30px); 
        max-width: 380px;
        max-height: calc(100vh - 110px); 
        /* Added Micro-Texture for the Mobile Menu Island */
        background-color: rgba(248, 250, 249, 0.85); 
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
        backdrop-filter: blur(25px); 
        -webkit-backdrop-filter: blur(25px);
        border: 1px solid rgba(255, 255, 255, 0.8);
        border-radius: 24px;
        flex-direction: column;
        align-items: stretch;
        padding: 20px 20px 40px 20px; 
        box-sizing: border-box; 
        box-shadow: 0 30px 60px rgba(0,0,0,0.12), inset 0 2px 10px rgba(255,255,255,0.5);
        transition: right 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease; 
        overflow-y: auto; 
        overflow-x: hidden;
        overscroll-behavior: contain; 
        gap: 0; 
    }

    .nav-links.active {
        right: 15px; 
    }

    .nav-links::-webkit-scrollbar { width: 5px; }
    .nav-links::-webkit-scrollbar-track { background: transparent; margin: 20px 0; }
    .nav-links::-webkit-scrollbar-thumb { background: rgba(46, 125, 50, 0.25); border-radius: 10px; }
    .nav-links::-webkit-scrollbar-thumb:hover { background: rgba(46, 125, 50, 0.6); }
    
    /* 3. "Widget Cards" Navigation */
    .nav-links > li {
        background: #ffffff;
        border-radius: 16px;
        margin-bottom: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03);
        border: 1px solid rgba(46, 125, 50, 0.05);
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, border-color 0.3s ease;
        overflow: hidden; 
        width: 100%;
        flex-shrink: 0; 
    }

    .nav-links > li:last-child {
        margin-bottom: 0;
    }

    .dropdown.mobile-active {
        border-color: rgba(46, 125, 50, 0.3);
        box-shadow: 0 10px 30px rgba(46, 125, 50, 0.12);
        transform: scale(1.02); 
    }

    .nav-links li a {
        font-size: 1.1rem;
        font-weight: 700;
        color: #37474F;
        padding: 16px 20px;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: color 0.3s ease;
    }

    .dropdown.mobile-active > a {
        color: #2E7D32;
    }

    /* 4. Inside the Widget (Accordion Dropdown) */
    .dropdown-content {
        position: static;
        transform: none !important;
        background: #ffffff;
        box-shadow: none;
        border: none;
        border-top: 1px dashed #e0e0e0; 
        border-radius: 0;
        min-width: 100%;
        display: block; 
        max-height: 0; 
        opacity: 0; 
        visibility: hidden;
        padding: 0 20px; 
        margin: 0;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease,
                    padding 0.3s ease,
                    visibility 0.3s ease, background-color 0.3s ease;
    }

    .dropdown:hover .dropdown-content {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        padding: 0 20px;
    }

    .dropdown.mobile-active .dropdown-content {
        max-height: 350px; 
        opacity: 1;
        visibility: visible;
        padding: 10px 20px 15px; 
    }

    .dropdown-content li { border-bottom: none; }

    .dropdown-content li a {
        font-size: 0.95rem;
        font-weight: 600;
        color: #546E7A;
        padding: 12px 0;
        border-bottom: 1px solid #f9fbf9;
        transition: color 0.3s ease, border-color 0.3s ease;
    }

    .dropdown-content li:last-child a { border-bottom: none; }
    
    .dropdown-content li a:hover,
    .dropdown-content li a:active {
        color: #2E7D32;
        padding-left: 10px; 
    }

    /* 5. Circular Interactive Badge for Arrows (MOBILE ONLY) */
    .dropbtn::after {
        margin-left: auto; 
        background: #f4f7f6; /* Grey circle */
        color: #90A4AE;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, color 0.3s ease;
    }

    .dropdown.mobile-active .dropbtn::after {
        transform: rotate(180deg);
        background: #2E7D32;
        color: #ffffff;
        box-shadow: 0 4px 10px rgba(46, 125, 50, 0.25);
    }

    /* =========================================================
       FIX: Prevent "Sticky Hover" on Mobile Dropdown Buttons 
       (PROPERLY PLACED INSIDE THE MOBILE MEDIA QUERY)
       ========================================================= */
       
    .dropdown > a.dropbtn {
        color: #37474F !important; 
    }
    
    .dropdown > a.dropbtn::after {
        transform: rotate(0deg) !important; 
        background-color: #f4f7f6 !important; 
        color: #546E7A !important; 
    }

    .dropdown.mobile-active > a.dropbtn {
        color: #2E7D32 !important; 
    }

    .dropdown.mobile-active > a.dropbtn::after {
        transform: rotate(180deg) !important; 
        background-color: #E8F5E9 !important; 
        color: #2E7D32 !important; 
    }
} /* <--- CLOSING BRACKET FOR MOBILE MEDIA QUERY */

/* Creates extra distance between 'Products' and the 'Contact' button */
@media (min-width: 993px) {
    .nav-links > li:last-child {
        margin-left: 2px;
    }
}

/* =========================================
   CONTACT BUTTON (Sweep In Left, Sweep Out Right + Active State)
   ========================================= */

@media (min-width: 993px) {
    
    .nav-links > li:last-child {
        height: 100px; 
        display: flex;
        align-items: center;
        margin-left: 100px; 
        padding-right: 0; 
    }

    .nav-links > li:last-child > a {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 101%; 
        padding: 0 50px; 
        background-color: #2F4213; 
        color: #ffffff !important;
        font-weight: 600;
        font-size: 1rem;
        text-decoration: none;
        overflow: hidden; 
        z-index: 1;
        transition: color 0.4s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.3s ease;
    }

    /* Change text to black when hovering OR when active */
    .nav-links > li:last-child > a:hover,
    .nav-links > li:last-child > a.active {
        color: #000000 !important;
    }

    /* 1. RESTING / EXIT STATE: Anchored to the right, width shrinks to 0 */
    .nav-links > li:last-child > a::before {
        content: '';
        position: absolute;
        top: 0;
        height: 101%;
        background-color: #a4df10; 
        z-index: -1; 
        right: 0; 
        left: auto;
        width: 0; 
        transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }

    /* 2. HOVER / ACTIVE STATE: Anchored to the left, width grows to 100% */
    .nav-links > li:last-child > a:hover::before,
    .nav-links > li:last-child > a.active::before {
        left: 0; 
        right: auto;
        width: 100%; 
        transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }
}


/* =========================================
   DARK THEME EXPLICIT OVERRIDES
   ========================================= */

/* Desktop Navbar */
body.dark-theme .navbar {
    background-color: rgba(18, 26, 29, 0.85); /* Deep dark frosted glass */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .logo-text {
    color: #81C784; 
}

body.dark-theme .nav-links li a {
    color: #CFD8DC;
}

body.dark-theme .nav-links li a:hover,
body.dark-theme .dropdown:hover .dropbtn::after {
    color: #81C784; 
}

/* Desktop Dropdown Content */
body.dark-theme .dropdown-content {
    background: rgba(26, 36, 40, 0.98); 
    border-top-color: #388E3C;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body.dark-theme .dropdown-content li a {
    color: #B0BEC5;
}

body.dark-theme .dropdown-content li a:hover {
    background-color: #121A1D;
    color: #81C784;
}

/* Mobile Navbar & Hamburger Logic */
@media (max-width: 992px) {
    body.dark-theme .navbar {
        background-color: rgba(18, 26, 29, 0.92);
    }
    
    body.dark-theme .hamburger-menu .bar {
        background-color: #81C784;
    }
    
    /* Mobile Glass Island Wrapper */
    body.dark-theme .nav-links {
        background-color: rgba(26, 36, 40, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 30px 60px rgba(0,0,0,0.5), inset 0 2px 10px rgba(255,255,255,0.05);
    }
    
    /* Mobile Widget Cards */
    body.dark-theme .nav-links > li {
        background: #1A2428;
        border-color: rgba(255, 255, 255, 0.05);
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    
    body.dark-theme .dropdown.mobile-active {
        border-color: rgba(129, 199, 132, 0.3);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }
    
    /* Mobile Links (High specificity override) */
    body.dark-theme .nav-links li a {
        color: #ECEFF1 !important;
    }
    
    body.dark-theme .dropdown.mobile-active > a {
        color: #81C784 !important;
    }
    
    /* Mobile Accordion Dropdown Content */
    body.dark-theme .dropdown-content {
        background: #121A1D !important;
        border-top-color: #2D3E45 !important;
    }
    
    body.dark-theme .dropdown-content li a {
        color: #CFD8DC !important;
        border-bottom-color: #2D3E45 !important;
    }
    
    body.dark-theme .dropdown-content li a:hover,
    body.dark-theme .dropdown-content li a:active {
        color: #81C784 !important;
    }
    
    /* Mobile Interactive Arrow Badge */
    body.dark-theme .dropdown > a.dropbtn::after {
        background-color: #2D3E45 !important;
        color: #90A4AE !important;
    }
    
    body.dark-theme .dropdown.mobile-active > a.dropbtn::after {
        background-color: #388E3C !important;
        color: #ffffff !important;
    }
}
