/* Mobile Menu Styles */

.mobile-menu-btn {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    color: var(--text-slate-200, #e2e8f0); /* Icon color */
    pointer-events: auto;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--primary, #2b8cee);
    border-color: var(--primary, #2b8cee);
}

.mobile-menu-btn.is-active {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Mobile Menu Overlay (Backdrop) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Container */
.mobile-menu-container {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0; /* Changed from -100% to 0, use transform for movement */
    width: 85%;
    max-width: 320px;
    height: 100%; /* Fallback for older browsers */
    height: 100dvh; /* Modern viewport unit for mobile */
    background-color: var(--bg-slate-900, #0f172a);
    z-index: 9999; /* Ensure it's on top of everything */
    transform: translateX(-100%); /* Start fully off-screen left */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Smooth easing */
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 25px rgba(0,0,0,0.5);
    border-right: 1px solid var(--border-slate-700, #334155);
    box-sizing: border-box;
    /* Ensure scrollbar doesn't shift content */
    scrollbar-gutter: stable;
}

/* Admin Bar Adjustments */
.admin-bar .mobile-menu-container {
    top: 32px;
    height: calc(100% - 32px);
    height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
    .admin-bar .mobile-menu-container {
        top: 46px;
        height: calc(100% - 46px);
        height: calc(100dvh - 46px);
    }
}

.mobile-menu-container * {
    box-sizing: border-box;
}

.mobile-menu-container.is-active,
.mobile-menu-container.open,
.mobile-menu-container.show {
    transform: translateX(0); /* Slide in to original position (left: 0) */
    display: flex !important;
    visibility: visible !important;
}

/* Header Section inside Menu */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem; /* Compact padding */
    border-bottom: 1px solid var(--border-slate-700, #334155);
    background-color: var(--bg-slate-950, #020617);
    flex-shrink: 0; /* Prevent shrinking */
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.mobile-logo .logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary, #2b8cee), var(--primary-hover, #1f7ad9));
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 6px -1px var(--shadow-primary, rgba(43, 140, 238, 0.2));
}

.mobile-logo .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.mobile-logo .logo-main {
    font-size: 0.875rem;
    font-weight: 800;
    color: white;
    letter-spacing: 0.05em;
}

.mobile-logo .logo-sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-slate-400, #94a3b8);
    letter-spacing: 0.1em;
}

.mobile-menu-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-slate-700, #334155);
    background: transparent;
    color: var(--text-slate-300, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background-color: rgba(255,255,255,0.05);
    color: white;
    border-color: var(--text-slate-500, #64748b);
}

/* Body Section (Scrollable) */
.mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

/* Mobile Navigation Menu */
.mobile-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.mobile-nav .menu, 
.mobile-nav-ul { /* Support both standard and fallback menu classes */
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.mobile-nav .menu-item a,
.mobile-nav .nav-link {
    display: block;
    padding: 0.75rem 1.25rem; /* Reduced padding for compact view */
    color: var(--text-slate-300, #cbd5e1) !important; /* Force color to override theme defaults */
    text-decoration: none;
    font-size: 1rem; /* Slightly smaller */
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.mobile-nav .menu-item a:visited,
.mobile-nav .nav-link:visited {
    color: var(--text-slate-300, #cbd5e1) !important;
}

.mobile-nav .menu-item a:hover,
.mobile-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.03);
    color: white !important;
    border-left-color: var(--primary, #2b8cee);
    padding-left: 1.5rem; /* Reduced shift */
}

/* Submenu Styles */
.mobile-nav .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0,0,0,0.2);
    display: none; /* Hidden by default */
    overflow: hidden;
    transition: height 0.4s ease;
    box-shadow: inset 0 4px 6px -2px rgba(0,0,0,0.3);
}

.mobile-nav .sub-menu .menu-item a {
    padding-left: 2rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.9rem;
    color: var(--text-slate-400, #94a3b8);
    border-left: none;
}

.mobile-nav .sub-menu .menu-item a:hover {
    color: white;
    padding-left: 2.25rem;
    background-color: rgba(255,255,255,0.02);
}

/* Arrow for items with submenus */
.mobile-nav .menu-item-has-children > a {
    position: relative;
    padding-right: 3rem;
}

.mobile-nav .menu-item-has-children > a::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    font-size: 1.25rem;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    color: var(--text-slate-500, #64748b);
}

.mobile-nav .menu-item-has-children.submenu-open > a {
    color: white;
    background-color: rgba(255,255,255,0.03);
}

.mobile-nav .menu-item-has-children.submenu-open > a::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary, #2b8cee);
}

/* Footer Section */
.mobile-menu-footer {
    padding: 1rem 1.25rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)); /* Safe area for iPhone home bar */
    border-top: 1px solid var(--border-slate-700, #334155);
    background-color: var(--bg-slate-950, #020617);
    flex-shrink: 0;
}

.btn-mobile-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem; /* Slightly reduced */
    background-color: var(--primary, #2b8cee);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
    transition: background-color 0.2s;
    box-shadow: 0 4px 6px -1px var(--shadow-primary, rgba(43, 140, 238, 0.3));
}

.btn-mobile-contact:hover {
    background-color: var(--primary-hover, #1f7ad9);
}

/* Media Query for Mobile */
@media (max-width: 991px) {
    .nav-menu {
        display: none; /* Hide desktop nav */
    }

    .mobile-menu-btn {
        display: block; /* Show hamburger icon */
    }

    .header .actions .whatsapp-btn {
        display: none; /* Hide whatsapp button on mobile header */
    }
}
