/* General Reset */
body { margin: 0; font-family: Arial, sans-serif; background-color: #f9f9f9; }

/* --- HEADER Styling --- */
header {
    background-color: #2E7D32;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    
    /* THESE TWO LINES MAKE IT STICKY */
    position: sticky; 
    top: 0; 
    
    z-index: 1000; /* Keeps the header above all other scrolling content */
}

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

/* Logo & Text Integration */
.logo a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 22px; /* Slightly larger for the brand name */
    font-weight: bold;
    letter-spacing: 0.5px;
}

.logo img {
    height: 40px;
    margin-right: 12px;
    /* NOTE: If your new IPMicon.png is black/dark, leave the line below to turn it white. 
       If it is already white or colored and you want to keep its original colors, delete the filter line below! */
    filter: brightness(0) invert(1); 
}

/* HAMBURGER ICON (Hidden on Desktop) */
.menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

/* Navigation */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

nav ul li {
    position: relative;
    margin-left: 15px;
}

nav a {
    text-decoration: none;
    color: white;
    padding: 10px;
    display: block;
    font-size: 15px;
}
nav a:hover { background-color: rgba(255,255,255,0.2); border-radius: 4px; }

/* SEARCH FORM */
.search-form {
    position: relative;
    display: flex;
    align-items: center;
}
.search-form input {
    padding: 6px 30px 6px 10px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    width: 200px;
}
.search-form button {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
}

/* --- DROPDOWNS (DESKTOP) --- */
/* Hide mobile icons on desktop */
.mobile-only { display: none; }

/* Show submenu on hover for desktop */
@media (min-width: 769px) {
    .has-dropdown:hover > .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
    }
    .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #43A047; /* Lighter Green */
        min-width: 200px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        z-index: 9999;
        border-radius: 4px;
    }
    /* Level 2 Submenu (Product List) */
    .dropdown-menu .dropdown-menu {
        left: 100%;
        top: 0;
        background-color: #66BB6A; /* Even Lighter */
    }
}

/* --- HERO & HOMEPAGE GRID (RESTORED) --- */

.hero {
    /*background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4)), url('images/roses-kenya.jpg');*/
    background-color: #f5f5e9;
    background-size: cover;
    background-position: center;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.hero-content {
    max-width: 1100px; 
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.hero-header h1 {
    font-size: 3.5rem;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    color: white;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.9);
    line-height: 1.1;
}

.hero-header .lead {
    font-size: 1.5rem;
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 40px;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.9);
}

/* RESTORED GRID SYSTEM */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 Columns */
    gap: 20px;
    margin-bottom: 40px;
    text-align: left; 
}

.hero-card {
    /* CHANGE BACKGROUND: From dark tint to light white tint */
    background: rgba(255, 255, 255, 0.7); 
    
    backdrop-filter: blur(5px); 
    padding: 25px;
    border-radius: 12px;
    
    /* CHANGE BORDER: Make it subtle grey instead of white */
    border: 1px solid rgba(0, 0, 0, 0.1);
    
    /* CHANGE TEXT COLOR: Dark grey */
    color: #333;
    
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-5px);
    border-color: #2E7D32; 
}

/* Find this block in style.css */
.hero-card.full-width {
    grid-column: span 2; 
    text-align: center;
    
    /* CHANGE THIS LINE: from rgba(0,0,0,0.3) to white (or match your other cards) */
    background: rgba(255, 255, 255, 0.7); 
}

.hero-card h3 {
    color: #4CAF50;
    margin-top: 0;
    font-size: 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.hero-card p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* TRUEPEST FEATURES */
.truepest-features {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    flex: 1;
    min-width: 150px;
}

.feature-title {
    display: block;
    color: #ffd700;
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.feature-desc {
    display: block;
    font-size: 0.9rem;
    
    /* CHANGE FROM #ccc TO #555 */
    color: #555;
}
/* CTA BUTTONS */
.final-statement {
    font-size: 1.2rem;
    font-weight: bold;
    
    /* CHANGE FROM white TO #333 */
    color: #333;
    
    margin-bottom: 25px;
    
    /* OPTIONAL: Remove the black shadow as it might look messy on dark text */
    text-shadow: none; 
}

.btn-main {
    display: inline-block;
    background-color: #2E7D32;
    color: white;
    padding: 18px 50px;
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 100, 0, 0.4);
    transition: all 0.3s;
    border: 2px solid #2E7D32;
}

.btn-main:hover {
    background-color: #1B5E20;
    border-color: #1B5E20;
    transform: scale(1.05);
}

/* --- MOBILE RESPONSIVE STYLES --- */
@media (max-width: 768px) {
    
    /* 1. Header Container - Allow wrapping so search drops to next line if needed */
    .header-container {
        flex-wrap: wrap;
        gap: 15px;
    }

    /* 2. Show Hamburger Menu & Position it */
    .menu-toggle { 
        display: block; 
        color: white;
        font-size: 24px;
        cursor: pointer;
        order: 1; /* Pushes it to the right of the logo */
    }

    /* 3. Logo adjustment */
    .logo { flex: 1; }

    /* 4. Search Bar - Full width on mobile */
    .search-item { 
        width: 100%; 
        order: 3; /* Pushes search bar below logo and hamburger */
    }
    .search-form input { width: 100%; box-sizing: border-box; }

    /* 5. Hide the Sub-Header Links by Default */
    .sub-header {
        display: none; /* Hidden until toggled via JS */
        width: 100%;
        padding: 0;
    }
    
    /* Class added by JavaScript to show the menu */
    .sub-header.active {
        display: block;
    }

    /* 6. Stack the Nav Links vertically */
    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0;
    }
    
    .nav-links li {
        width: 100%;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .nav-links li a {
        display: block;
        padding: 15px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Hide the visual dividers (|) on mobile */
    .nav-divider {
        display: none;
    }

    /* 7. RESTORE GRID STACKING FOR MOBILE */
    .hero-grid {
        grid-template-columns: 1fr; /* Stack in 1 column */
    }
    .hero-card.full-width {
        grid-column: span 1;
    }
    .truepest-features {
        flex-direction: column;
    }
    
    .hero-header h1 { font-size: 2.2rem; }
    .hero-header .lead { font-size: 1.2rem; }
}

/* --- PRODUCT & GENERAL STYLING --- */

.container { max-width: 1200px; margin: 40px auto; padding: 0 20px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 20px;
}

.product-card {
    background: white; border: 1px solid #eee; border-radius: 8px;
    display: flex; flex-direction: column; overflow: hidden;
    transition: transform 0.2s;
}
.product-card:hover { transform: translateY(-5px); border-color: #2E7D32; }

.card-image img { width: 100%; height: 200px; object-fit: cover; }
.card-info { padding: 15px; text-align: center; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }

/* Product Details */
.product-wrapper {
    display: flex;
    gap: 40px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.product-image { flex: 1; }
.product-image img { width: 100%; height: auto; border-radius: 4px; border: 1px solid #ddd; }
.product-details { flex: 1; }

/* Tables */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; }
.cart-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.cart-table th, .cart-table td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
.cart-table th { background: #f8f8f8; }

/* Buttons */
.btn-buy, .btn-view, .btn-submit, .btn-checkout {
    padding: 10px 20px; border-radius: 4px; text-decoration: none; border: none; cursor: pointer; display: inline-block; font-size: 16px;
}
.btn-buy { background: #2E7D32; color: white; }
.btn-view { background: #f0f0f0; color: #333; }

/* Auth Forms */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.auth-form input, .auth-form select, .auth-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; 
}

/* Footer */
.site-footer {
    background-color: #333; color: white; padding: 40px 0 0 0; margin-top: 50px;
}
.footer-content {
    display: flex; justify-content: space-around; max-width: 1200px; margin: 0 auto; padding-bottom: 20px; flex-wrap: wrap;
}
.footer-section h3 { border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 15px; }
.footer-section ul { list-style: none; padding: 0; }
.footer-section ul li a { color: #ccc; text-decoration: none; line-height: 2; }

/* Mobile Adjustments */
@media (max-width: 600px) {
    .product-grid { grid-template-columns: 1fr; }
    .product-wrapper { flex-direction: column; }
    .auth-container { width: 100%; padding: 20px; box-sizing: border-box; }
}


/* Ensure the dropdown menu is hidden by default */
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    border-radius: 4px;
}

/* Show the menu when hovering over the parent LI */
.dropdown:hover .dropdown-menu {
    display: block;
}

/* Style the links inside the dropdown */
.dropdown-menu li a {
    color: #333 !important; /* Overriding header green */
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.dropdown-menu li a:hover {
    background-color: #f1f1f1;
    color: #2E7D32 !important;
}

/* Ensure the parent link stays relatively positioned for the absolute menu */
.dropdown {
    position: relative;
}

/* Final fix for header dropdown visibility */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff; /* Use white background for contrast */
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-top: 3px solid #2E7D32;
    padding: 10px 0;
    z-index: 9999;
}

/* Force show on hover */
.dropdown:hover .dropdown-menu {
    display: block !important;
}

.dropdown-menu li {
    width: 100%;
    margin: 0 !important;
}

.dropdown-menu li a {
    color: #333 !important; /* Overriding global white header text */
    padding: 10px 20px !important;
    font-size: 14px;
    display: block;
}

.dropdown-menu li a:hover {
    background-color: #e8f5e9;
    color: #2E7D32 !important;
}

/* Syncing Refactored Header with Dropdown Logic */
#mainNav ul li.dropdown {
    position: relative;
}

/* Force display on hover */
#mainNav ul li.dropdown:hover > .dropdown-menu {
    display: block !important;
    opacity: 1;
    visibility: visible;
}

/* Ensure dropdown-menu positions correctly below the parent */
#mainNav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-top: 3px solid #ffd700; /* Matching your cart badge gold */
    padding: 10px 0;
    margin: 0;
    z-index: 9999;
}

#mainNav .dropdown-menu li {
    width: 100%;
    margin: 0;
}

#mainNav .dropdown-menu li a {
    color: #333 !important; 
    padding: 10px 20px !important;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

#mainNav .dropdown-menu li a:hover {
    background-color: #f1f1f1;
    color: #2E7D32 !important;
}

/* Definitive Dropdown Fix for Desktop */
@media (min-width: 769px) {
    /* 1. Ensure parent is the reference point */
    nav ul li.dropdown {
        position: relative;
    }

    /* 2. Show the menu when the PARENT is hovered */
    nav ul li.dropdown:hover > .dropdown-menu {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }

    /* 3. Force consistent styling for the menu box */
    .dropdown-menu {
        display: none; /* Hide by default */
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #ffffff;
        min-width: 220px;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
        border-top: 3px solid #ffd700; /* Matching your cart badge gold */
        padding: 10px 0;
        margin: 0;
        z-index: 9999;
    }

    /* 4. Style the dropdown links so they are readable on white background */
    .dropdown-menu li {
        width: 100%;
        margin: 0;
    }

    .dropdown-menu li a {
        color: #333 !important; 
        padding: 12px 20px !important;
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left;
    }

    .dropdown-menu li a:hover {
        background-color: #f1f1f1;
        color: #2E7D32 !important;
    }
}

/* Fix for Header Dropdowns on Desktop */
@media (min-width: 769px) {
    nav ul li.dropdown { position: relative; }
    nav ul li.dropdown:hover > .dropdown-menu { display: block !important; visibility: visible; opacity: 1; }
    .dropdown-menu {
        display: none; position: absolute; top: 100%; left: 0;
        background-color: #ffffff; min-width: 220px;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
        border-top: 3px solid #ffd700; z-index: 9999; padding: 10px 0;
    }
    .dropdown-menu li a { color: #333 !important; padding: 12px 20px !important; display: block; }
    .dropdown-menu li a:hover { background-color: #f1f1f1; color: #2E7D32 !important; }
}

/* Final High-Resolution Dropdown Fix */
@media (min-width: 769px) {
    nav ul li.dropdown { position: relative; }

    /* Force the menu to display when the .dropdown list item is hovered */
    nav ul li.dropdown:hover > .dropdown-menu {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }

    /* Style the dropdown menu correctly for white-background readability */
    .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #ffffff;
        min-width: 220px;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
        border-top: 3px solid #ffd700;
        padding: 10px 0;
        z-index: 9999;
    }

    .dropdown-menu li a {
        color: #333 !important; 
        padding: 12px 20px !important;
        display: block;
        width: 100%;
    }

    .dropdown-menu li a:hover {
        background-color: #f1f1f1;
        color: #2E7D32 !important;
    }
}

/* --- SUB-HEADER Styling --- */
.sub-header {
    background-color: #f8f9fa; /* Light grey for contrast */
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

.sub-header .header-container {
    padding: 0 20px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    gap: 20px;
    align-items: center;
}

.nav-links li a {
    text-decoration: none;
    color: #444;
    font-size: 18px;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links li a:hover {
    color: #2E7D32; /* Russell IPM Green */
}

/* Icons inside links */
.nav-links li a i {
    margin-right: 5px;
    color: #2E7D32;
}

.nav-divider {
    color: #ccc;
    font-weight: normal;
}

/* Cart Badge Styling */
.cart-badge {
    background: #ffd700;
    color: #333;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    vertical-align: top;
    margin-left: 2px;
}

/* Top Nav (Logout link) adjustments */
#topNav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#topNav ul li a {
    color: white;
    text-decoration: none;
    font-size: 14px;
}

/* --- MOBILE CATEGORY BAR (Swipeable White Bar) --- */
.mobile-category-bar {
    background-color: #ffffff !important; /* Forces the white background */
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 15px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* Enables horizontal swiping */
    -webkit-overflow-scrolling: touch; /* Smooth swiping on iPhones */
    white-space: nowrap; /* Forces everything onto one single line */
}

/* Hide the scrollbar for a cleaner look */
.mobile-category-bar::-webkit-scrollbar { display: none; }
.mobile-category-bar { -ms-overflow-style: none; scrollbar-width: none; }

.mobile-category-links {
    list-style: none !important; /* Removes the bullet points */
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important; /* Forces items to sit side-by-side */
    gap: 20px; /* Space between each category */
    align-items: center;
}

.mobile-category-links li {
    margin: 0 !important;
    padding: 0 !important;
}

.mobile-category-links li a {
    text-decoration: none !important;
    color: #000000 !important; /* Forces the text to be black */
    font-size: 15px;
    font-weight: 600;
    display: block;
    white-space: nowrap; 
}

/* Ensure this whole bar ONLY shows on mobile */
@media (min-width: 769px) {
    .mobile-category-bar {
        display: none !important;
    }
}

/* Hide the duplicate categories inside the mobile hamburger menu */
@media (max-width: 768px) {
    .category-link-item {
        display: none !important;
    }
}