/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger-icon span {
    width: 25px;
    height: 2px;
    background: #333;
    transition: all 0.3s ease;
}

/* Show on mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}

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

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: #ffffff;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    overflow: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-drawer.active {
    left: 0;
}

/* Drawer Header */
.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
}

.mobile-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: #333;
    line-height: 1;
}

/* Panel Container */
.mobile-panel-container {
    position: relative;
    height: calc(100% - 60px);
    overflow: hidden;
}

/* Panels */
.mobile-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
}

.mobile-panel.active {
    transform: translateX(0);
}

.mobile-panel.slide-left {
    transform: translateX(-100%);
}

/* Menu Items */
.mobile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 24px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    color: #333;
    text-align: left;
    border-bottom: 1px solid #f5f5f5;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus {
    background: #f9f9f9;
    outline: none;
}

.mobile-menu-item.has-submenu::after {
    content: '›';
    font-size: 24px;
    color: #666;
    margin-left: auto;
}

/* Back Button */
.mobile-back-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 24px;
    border: none;
    background: #f9f9f9;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 8px;
    color: #333;
    text-align: left;
}

.mobile-back-btn:hover {
    background: #f0f0f0;
}

.back-arrow {
    font-size: 24px;
    margin-right: 12px;
    color: #666;
    line-height: 1;
}

/* Submenu Wrapper */
.mobile-submenu-wrap {
    display: contents;
}

/* Hide nested ul elements (handled by panels) */
.mobile-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Smooth scrolling */
.mobile-panel {
    -webkit-overflow-scrolling: touch;
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Loading state */
.mobile-drawer.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Animation delays for menu items */
.mobile-panel.active .mobile-menu-item,
.mobile-panel.active .mobile-back-btn {
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Different delay for each item */
.mobile-panel.active .mobile-menu-item:nth-child(1) { animation-delay: 0.05s; }
.mobile-panel.active .mobile-menu-item:nth-child(2) { animation-delay: 0.1s; }
.mobile-panel.active .mobile-menu-item:nth-child(3) { animation-delay: 0.15s; }
.mobile-panel.active .mobile-menu-item:nth-child(4) { animation-delay: 0.2s; }
.mobile-panel.active .mobile-menu-item:nth-child(5) { animation-delay: 0.25s; }
.mobile-panel.active .mobile-menu-item:nth-child(6) { animation-delay: 0.3s; }

/* Accessibility */
.mobile-menu-item:focus-visible,
.mobile-drawer-close:focus-visible,
.mobile-back-btn:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: -2px;
}
