/**
 * BTFC Stats Independent Menu System - Mobile Menu Component
 * 
 * Styles for mobile menu and hamburger toggle
 * 
 * @package BTFC_Stats
 * @since 1.0.0
 */

/* ============================================
   Mobile Menu Toggle
   ============================================ */

.btfc-mobile-menu-toggle {
    display: none;
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
    align-self: center;
}

.btfc-menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.btfc-menu-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btfc-menu-toggle-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ============================================
   Hamburger Icon
   ============================================ */

.btfc-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 16px;
    position: relative;
}

.btfc-hamburger-line {
    width: 100%;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger animation when menu is open */
.btfc-menu-toggle-btn[aria-expanded="true"] .btfc-hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.btfc-menu-toggle-btn[aria-expanded="true"] .btfc-hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.btfc-menu-toggle-btn[aria-expanded="true"] .btfc-hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Mobile Menu Dropdown
   ============================================ */

.btfc-mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--btfc-menu-bg);
    box-shadow: var(--btfc-menu-shadow);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.btfc-mobile-menu[aria-hidden="false"] {
    transform: translateY(0);
}

.btfc-mobile-menu-content {
    padding: 20px;
}

/* ============================================
   Mobile Menu List
   ============================================ */

.btfc-mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.btfc-mobile-menu-item {
    margin: 0 0 10px 0;
    list-style: none;
    position: relative;
}

.btfc-mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    touch-action: manipulation;
    cursor: pointer;
}

.btfc-mobile-menu-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Mobile Submenu
   ============================================ */

.btfc-mobile-menu-item.has-submenu {
    position: relative;
}

.btfc-mobile-menu-item.has-submenu .btfc-mobile-menu-link {
    padding-right: 60px; /* Make room for the toggle button */
}

.btfc-submenu-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    z-index: 10;
}

.btfc-submenu-toggle::before {
    content: '+';
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btfc-submenu-toggle[aria-expanded="true"]::before {
    content: '−';
    transform: rotate(0deg);
}

.btfc-submenu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btfc-mobile-submenu {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.btfc-mobile-submenu[aria-expanded="true"] {
    max-height: 500px;
    opacity: 1;
}

.btfc-mobile-submenu-item {
    margin: 0;
    list-style: none;
}

.btfc-mobile-submenu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 40px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    border-left: 3px solid transparent;
    touch-action: manipulation;
    cursor: pointer;
}

.btfc-mobile-submenu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--btfc-menu-accent);
    transform: translateX(5px);
}

/* ============================================
   Mobile Menu Styles (Dropdown, Slide, Overlay)
   ============================================ */

/* Dropdown Style (default) */
.btfc-independent-menu[data-mobile-style="dropdown"] .btfc-mobile-menu {
    position: absolute;
    transform: translateY(-100%);
}

.btfc-independent-menu[data-mobile-style="dropdown"] .btfc-mobile-menu[aria-hidden="false"] {
    transform: translateY(0);
}

/* Slide Style */
.btfc-independent-menu[data-mobile-style="slide"] .btfc-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateX(-100%);
    max-height: 100vh;
    z-index: 10000;
}

.btfc-independent-menu[data-mobile-style="slide"] .btfc-mobile-menu[aria-hidden="false"] {
    transform: translateX(0);
}

/* Overlay Style */
.btfc-independent-menu[data-mobile-style="overlay"] .btfc-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 57, 140, 0.95);
    backdrop-filter: blur(10px);
    transform: scale(0.8) translateY(-50px);
    opacity: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btfc-independent-menu[data-mobile-style="overlay"] .btfc-mobile-menu[aria-hidden="false"] {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.btfc-independent-menu[data-mobile-style="overlay"] .btfc-mobile-menu-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .btfc-mobile-menu-toggle {
        display: block;
    }
    
    .btfc-top-menu,
    .btfc-bottom-menu {
        display: none;
    }
}

@media (min-width: 769px) {
    .btfc-mobile-menu {
        display: none !important;
    }
    
    .btfc-mobile-menu-toggle {
        display: none !important;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.btfc-mobile-menu[aria-hidden="true"] {
    display: none;
}

.btfc-mobile-menu[aria-hidden="false"] {
    display: block;
}

/* Focus management for mobile menu */
.btfc-mobile-menu-link:focus,
.btfc-submenu-toggle:focus,
.btfc-mobile-submenu-link:focus {
    outline: 2px solid var(--btfc-menu-accent);
    outline-offset: 2px;
}

/* ============================================
   Animation Enhancements
   ============================================ */

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btfc-mobile-menu-item {
    animation: slideInFromTop 0.3s ease forwards;
}

.btfc-mobile-menu-item:nth-child(1) { animation-delay: 0.1s; }
.btfc-mobile-menu-item:nth-child(2) { animation-delay: 0.2s; }
.btfc-mobile-menu-item:nth-child(3) { animation-delay: 0.3s; }
.btfc-mobile-menu-item:nth-child(4) { animation-delay: 0.4s; }
.btfc-mobile-menu-item:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .btfc-mobile-menu,
    .btfc-mobile-menu-link,
    .btfc-submenu-toggle,
    .btfc-mobile-submenu,
    .btfc-hamburger-line {
        transition: none !important;
        animation: none !important;
    }
}
