/*  Mobile Nav Fix — 2026-05-22 — Opie / AppWT LLC
    Empire's main.css hides .nav-menu (display:none) at mobile but never had a .nav-menu.active rule,
    so the hamburger toggled a class that styled nothing. This file replaces that with a working
    slide-in panel pattern that shows when JS adds the .active class.
*/

@media (max-width: 768px) {
    .navbar .nav-menu {
        display: flex !important;
        position: fixed !important;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 360px;
        height: 100vh;
        height: 100dvh;
        background: #ffffff;
        flex-direction: column !important;
        align-items: stretch;
        justify-content: flex-start;
        padding: 80px 20px 30px 20px;
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.18);
        transition: right 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        z-index: 9998;
        box-sizing: border-box;
        gap: 0.4rem;
        margin: 0 !important;
    }

    .navbar .nav-menu.active {
        right: 0;
    }

    .navbar .nav-menu > .nav-link {
        width: 100%;
        padding: 14px 10px;
        font-size: 1rem;
        border-bottom: 1px solid #e5e7eb;
        display: block;
    }

    .navbar .nav-menu .nav-item {
        width: 100%;
    }

    .navbar .nav-menu .nav-item > .nav-link {
        display: block;
        padding: 14px 10px;
        border-bottom: 1px solid #e5e7eb;
    }

    /* Dropdowns expand inline on mobile, not as floating panels */
    .navbar .nav-menu .services-dropdown,
    .navbar .nav-menu .locations-dropdown {
        position: static !important;
        transform: none !important;
        background: #f8fafc !important;
        padding: 6px 8px 10px 14px !important;
        margin: 0 !important;
        box-shadow: none !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        width: 100%;
        border-radius: 0 !important;
    }

    .navbar .nav-menu .dropdown-grid {
        display: block !important;
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    .navbar .nav-menu .dropdown-column {
        margin: 6px 0 12px 0;
    }

    .navbar .nav-menu .dropdown-column h4 {
        font-size: 0.85rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin: 6px 0;
        color: #475569;
    }

    .navbar .nav-menu .dropdown-column ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .navbar .nav-menu .dropdown-column li a {
        display: block;
        padding: 8px 8px 8px 4px;
        font-size: 0.95rem;
        color: #1f2937;
        text-decoration: none;
    }

    .navbar .nav-menu .nav-dual-phone {
        display: flex !important;
        flex-direction: column;
        padding: 14px 10px;
        gap: 10px;
        border-top: 2px solid #e5e7eb;
        margin-top: 14px;
    }

    .navbar .nav-menu .nav-dual-phone .phone-label {
        font-size: 0.78rem;
        font-weight: 700;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .navbar .nav-menu .nav-dual-phone .phone-number {
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e3a8a;
        text-decoration: none;
    }

    /* Hamburger button on top of the panel */
    .mobile-menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 9999;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 22px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        background: currentColor;
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Backdrop overlay when menu is open */
    body:has(.nav-menu.active)::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9997;
        animation: fadeIn 0.2s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}
