.main-nav {
    background-color: rgba(250, 235, 215, 0.85); /* FAEBD7 with 85% opacity - more transparent */
    padding: 1rem 0;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(3px); /* Slightly more blur effect */
    border-radius: 8px; /* Match main body rounded corners */
    margin: 0 auto;
    max-width: 1400px; /* Match site wrapper max-width */
    position: relative; /* Ensure stacking context */
    z-index: 1001; /* Higher than other content */
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center; /* Ensure proper alignment when wrapping */
    gap: 0.5rem; /* Add consistent gap between items */
}

.main-nav li {
    margin: 0.25rem 0.5rem; /* Reduced default margins */
    flex-shrink: 0; /* Prevent items from shrinking too much */
}

.main-nav a {
    text-decoration: none;
    color: #0066cc;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.main-nav a:hover {
    background-color: #0066cc;
    color: #FAEBD7;
}

/* Red text for Red Light & Collagen menu item */
.red-light-menu {
    color: #cc0000 !important;
    font-weight: bold !important;
}

.red-light-menu:hover {
    background-color: #cc0000 !important;
    color: #FAEBD7 !important;
}

/* Red text for all Red Light & Collagen dropdown options */
.red-light-menu + .dropdown-content a {
    color: #cc0000 !important;
}

.red-light-menu + .dropdown-content a:hover {
    background-color: #cc0000 !important;
    color: #FAEBD7 !important;
}

/* Mobile responsive design */
@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    .main-nav li {
        margin: 5px 0; /* Reduced for smaller spacing */
        width: 70%; /* Reduced width for narrower buttons */
        text-align: center;
    }

    .main-nav a {
        background-color: #25D366 !important; /* WhatsApp green background */
        color: white !important;
        padding: 10px 15px !important; /* Reduced padding for smaller menu items */
        border: 1px solid #1aa851 !important; /* Slightly darker green border */
        border-radius: 6px !important;
        font-size: 1em !important; /* Standard font size */
        font-weight: 500 !important;
        transition: all 0.3s ease;
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .main-nav a:hover {
        background-color: #1aa851 !important; /* Darker green on hover */
        color: white !important;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* Red Light & Collagen menu item - make text red */
    .red-light-menu {
        color: #ff0000 !important; /* Red text */
        font-weight: bold !important;
    }

    .red-light-menu:hover {
        color: #ff0000 !important; /* Keep red text on hover */
        background-color: #1aa851 !important; /* Green background on hover */
    }

    .mobile-nav-toggle {
        display: block;
        padding: 10px;
        text-align: right;
    }

    #menu-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 18px;
        cursor: pointer;
        padding: 10px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .menu-text {
        font-family: 'Montserrat', sans-serif;
    }

    #menu-toggle i {
        font-size: 20px;
    }

    .main-nav {
        display: none;
        width: 100%;
        background-color: #FAEBD7; /* Back to original color */
        padding: 10px 0; /* Back to original padding */
        border-radius: 8px;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
    }

    .main-nav li {
        width: 100%;
        text-align: center;
        margin: 3px 0; /* Reduced margin for smaller spacing */
    }
}

/* Critical laptop sizes where navigation commonly breaks */
@media (min-width: 769px) and (max-width: 900px) {
    .main-nav {
        padding: 0.2rem 0;
    }
    
    .main-nav ul {
        gap: 0.1rem; /* Minimal gap */
    }
    
    .main-nav li {
        margin: 0.1rem 0.05rem; /* Minimal margins */
    }
    
    .main-nav a {
        padding: 0.25rem 0.3rem; /* Very compact padding */
        font-size: 0.7rem; /* Small font to fit more items */
        border: 1px solid #bbb; /* Thinner border */
    }
    
    .dropdown-content {
        min-width: 150px;
        font-size: 0.75rem;
    }
}

/* Small Desktop / Large Tablet (769px - 1024px) - Compact navigation */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-nav {
        padding: 0.3rem 0;
    }
    
    .main-nav ul {
        flex-wrap: wrap; /* Allow wrapping if still too wide */
        justify-content: center;
        gap: 0.2rem; /* Add gap between items */
    }
    
    .main-nav li {
        margin: 0.2rem 0.1rem; /* Very small margins to prevent overlap */
        min-width: auto; /* Allow natural width */
    }
    
    .main-nav a {
        padding: 0.3rem 0.4rem; /* Much smaller padding */
        font-size: 0.75rem; /* Smaller font */
        border-radius: 3px;
        white-space: nowrap; /* Prevent text wrapping within buttons */
        display: inline-block;
    }
    
    .dropdown-content {
        min-width: 160px; /* Narrower dropdowns */
        font-size: 0.8rem;
    }
}

/* Very Small Desktop (900px - 1024px) - Extra compact */
@media (min-width: 900px) and (max-width: 1024px) {
    .main-nav a {
        padding: 0.35rem 0.5rem; /* Slightly more padding for readability */
        font-size: 0.8rem;
    }
}

/* Medium Desktop (1025px - 1200px) - Standard compact navigation */
@media (min-width: 1025px) and (max-width: 1200px) {
    .main-nav {
        padding: 0.6rem 0;
    }
    
    .main-nav ul {
        flex-wrap: wrap; /* Allow wrapping even on medium screens */
        justify-content: center;
        gap: 0.3rem;
    }
    
    .main-nav li {
        margin: 0.3rem 0.2rem; /* Reduced margin */
    }
    
    .main-nav a {
        padding: 0.4rem 0.7rem; /* Compact padding */
        font-size: 0.9rem;
    }
    
    .dropdown-content {
        min-width: 190px;
        font-size: 0.9rem;
    }
}

/* Laptop screens (1100px - 1300px) - Slightly more room */
@media (min-width: 1100px) and (max-width: 1300px) {
    .main-nav li {
        margin: 0.4rem 0.3rem;
    }
    
    .main-nav a {
        padding: 0.45rem 0.8rem;
        font-size: 0.92rem;
    }
}

/* Large Desktop (1201px+) - Full spacing */
@media (min-width: 1201px) {
    .main-nav li {
        margin: 0 1rem; /* Full margin for large screens */
    }
    
    .main-nav a {
        padding: 0.5rem 1rem; /* Full padding */
        font-size: 1rem;
    }
    
    .dropdown-content {
        min-width: 220px;
        font-size: 1rem;
    }
}

.nav-item-animation {
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInDown 0.5s ease forwards;
}

.nav-hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.active a {
    background-color: #0066cc;
    color: #FAEBD7 !important;
}

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

/* Add animation delay for each nav item */
.nav-item-animation:nth-child(1) { animation-delay: 0.1s; }
.nav-item-animation:nth-child(2) { animation-delay: 0.2s; }
.nav-item-animation:nth-child(3) { animation-delay: 0.3s; }
.nav-item-animation:nth-child(4) { animation-delay: 0.4s; }
.nav-item-animation:nth-child(5) { animation-delay: 0.5s; }
.nav-item-animation:nth-child(6) { animation-delay: 0.6s; }
.nav-item-animation:nth-child(7) { animation-delay: 0.7s; }

.dropdown {
    position: relative;
    display: inline-block;
    z-index: 1002; /* Higher than nav itself */
}

/* Update the dropdown content base state */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #FAEBD7;
    min-width: 220px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 1003; /* Highest z-index for dropdown content */
    border-radius: 4px;
    margin-top: 2px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

/* Desktop hover behavior */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        display: block;
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile click behavior */
@media (max-width: 768px) {
    .dropdown-content {
        display: none;
        position: static;
        width: 100%;
        box-shadow: none;
        background-color: #25D366 !important; /* WhatsApp green */
        opacity: 1;
        visibility: visible;
        margin-top: 0;
        border-radius: 6px;
        overflow: hidden;
    }

    .dropdown-content li a {
        background-color: #25D366 !important; /* WhatsApp green */
        color: white !important;
        padding: 10px 15px !important; /* Reduced padding */
        border: none !important;
        border-radius: 0 !important;
        border-bottom: 1px solid #1aa851 !important; /* Separator line */
        font-size: 0.95em !important; /* Slightly smaller font */
        font-weight: 400 !important;
    }

    .dropdown-content li:last-child a {
        border-bottom: none !important;
    }

    .dropdown-content li a:hover {
        background-color: #1aa851 !important; /* Darker green on hover */
        color: white !important;
    }

    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    /* Remove opacity and visibility transitions for mobile */
    .dropdown-content {
        transition: none;
        opacity: 1;
        visibility: visible;
    }
}

.dropdown-content li {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

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

.dropdown-content li a {
    display: block;
    padding: 12px 20px;
    color: #0066cc;
    text-decoration: none;
    border: none;
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

.dropdown-content li a:hover {
    background-color: #0066cc;
    color: #FAEBD7;
}

/* Mobile behavior */
@media (max-width: 768px) {
    .dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        margin-top: 5px;
        background-color: #25D366 !important; /* WhatsApp green */
    }

    .dropdown:hover .dropdown-content {
        display: none;  /* Disable hover on mobile */
    }

    .dropdown.active .dropdown-content {
        display: block;  /* Show on click for mobile */
    }
    
    .dropdown-content li {
        text-align: center;
    }

    /* Add dropdown indicator for mobile */
    .dropdown-toggle:after {
        content: '▼';
        margin-left: 8px; /* Increased for larger menu */
        display: inline-block;
        transition: transform 0.3s;
        color: white !important;
        font-size: 1em; /* Slightly larger indicator */
    }

    .dropdown.active .dropdown-toggle:after {
        transform: rotate(180deg);
    }
}

.mobile-nav-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
        padding: 10px;
        text-align: right;
    }

    #menu-toggle {
        background: #25D366; /* WhatsApp green background */
        border: 1px solid #1aa851; /* Slightly darker green border */
        color: white;
        font-size: 18px;
        cursor: pointer;
        padding: 10px 15px; /* Slightly more padding for better appearance */
        display: flex;
        align-items: center;
        gap: 8px;
        border-radius: 6px; /* Rounded corners to match menu items */
        transition: all 0.3s ease; /* Smooth transition */
    }

    #menu-toggle:hover {
        background: #1aa851; /* Darker green on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .menu-text {
        font-family: 'Montserrat', sans-serif;
    }

    #menu-toggle i {
        font-size: 20px;
    }

    .main-nav {
        display: none;
        width: 100%;
        background-color: #FAEBD7; /* Back to original color for mobile */
        padding: 10px 0; /* Back to original padding */
        border-radius: 8px;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
    }

    .main-nav li {
        width: 100%;
        text-align: center;
        margin: 3px 0; /* Reduced margin for smaller spacing */
    }

    /* Ensure Red Light & Collagen text is red in mobile */
    .main-nav .red-light-menu {
        color: #ff0000 !important; /* Red text */
        font-weight: bold !important;
    }

    .main-nav .red-light-menu:hover {
        color: #ff0000 !important; /* Keep red text on hover */
        background-color: #1aa851 !important; /* Green background on hover */
    }
}