/* Mobile Offcanvas Menu Styling */
#menu {
    background-color: #8e0101 !important;
    color: #ffffff;
    box-shadow: none;
    padding: 0 !important;
    /* Remove all padding from the container */
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    -moz-transform: translateX(100%) !important;
    -webkit-transform: translateX(100%) !important;
    -ms-transform: translateX(100%) !important;
    transform: translateX(100%) !important;
    transition: transform 0.5s ease-in-out !important;
}

body.is-menu-visible #menu {
    -moz-transform: translateX(0) !important;
    -webkit-transform: translateX(0) !important;
    -ms-transform: translateX(0) !important;
    transform: translateX(0) !important;
}

#menu .inner-container {
    padding-top: 4em;
    /* Leave space for close button */
}

#menu ul {
    list-style: none;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}

#menu ul li {
    padding: 0 !important;
    margin: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 100%;
}

#menu ul li:first-child {
    border-top: none !important;
}

#menu ul li a {
    display: block;
    padding: 0.7em 1.25em !important;
    /* Minimal but readable vertical padding */
    color: #ffffff !important;
    text-decoration: none;
    border: 0;
    font-size: 0.85em !important;
    /* Reduced font size further */
    font-weight: 500;
    letter-spacing: 0.5px;
    width: 100%;
}

#menu ul li a:hover {
    color: #ffd700 !important;
    background-color: rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

/* Dropdown Accordion Styles */
.dropdown-btn {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding-right: 1em !important;
}

.dropdown-content {
    background-color: rgba(0, 0, 0, 0.2) !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

.dropdown-content li {
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.dropdown-content li a {
    font-size: 0.8em !important;
    /* Smaller nested text */
    padding: 0.6em 1em 0.6em 2em !important;
    /* Tighter nested links */
}

.right-icon {
    font-size: 0.8em;
    opacity: 0.7;
}

#menu ul li span {
    display: block;
    padding: 1em 0;
    color: #ffd700;
    /* Gold for section headers like 'Our Services' */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9em;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    margin-top: 1em;
    margin-bottom: 0.5em;
    /* Ensure differentiation from normal items */
}

/* Close Button Styling */
#menu .close {
    background-image: url("images/close.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 1.5em;
    border: 0;
    content: '';
    display: block;
    height: 3.5em;
    position: absolute;
    right: 0.5em;
    top: 0.5em;
    width: 3.5em;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    z-index: 2;
}

#menu .close:hover {
    opacity: 1;
}

/* Navbar Background on Mobile/Scroll */
@media screen and (max-width: 980px) {
    #header {
        background-color: #8e0101 !important;
        /* Force Deep Red */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        height: auto;
        min-height: 60px;

        /* Flexbox for Mobile Header Alignment */
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 15px !important;
        /* Horizontal padding */
    }

    #header nav {
        position: static !important;
        /* Reset absolute positioning so flex works */
        top: auto !important;
        right: auto !important;
        height: auto !important;
        line-height: normal !important;
    }

    #header.alt {
        background-color: #8e0101 !important;
        /* Override alt transparency on mobile */
    }

    /* Adjust page wrapper so content isn't hidden under fixed header */
    #page-wrapper {
        padding-top: 80px !important;
        /* Slightly more space for the flex header */
    }

    /* Ensure the hamburger icon is visible and aligned */
    #header nav>ul>li>a.menuToggle {
        color: #fff !important;
        height: 60px;
        line-height: 60px;
        display: flex;
        /* Centers the icon content if needed */
        align-items: center;
    }

    #header h1 a {
        color: #fff !important;
        line-height: 60px;
        font-size: 1.2em;
    }

    /* TOGGLE VISIBILITY LOGIC (Replacing JS checkDevice) */
    /* Mobile Menu Container - Show on small screens */
    #ismobile {
        display: block !important;
    }

    /* Desktop Menu Container - Hide on small screens */
    #isDesktop {
        display: none !important;
    }

    /* Hide the button container styles if interfering */
    .btn-Menu {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        /* Removes the white outline/border defined in main.css */
        outline: none !important;
    }
}

/* Desktop View - Ensure correct visibility */
@media screen and (min-width: 981px) {
    #ismobile {
        display: none !important;
    }

    #isDesktop {
        display: block !important;
    }

    /* Ensure header returns to block/normal for desktop if needed, 
       though usually flex is fine. main.css might expect specific styling. */
    #header {
        display: block;
        /* Typically relative or fixed in main.css */
    }
}