/**
 * Hamburger Menu Styles
 * 
 * Animated hamburger icon and mobile menu overlay
 * 
 * @package CWE_Agency
 * @since 1.0.0
 */

/* ============================================
   1. HAMBURGER BUTTON
   ============================================ */

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: var(--cwe-z-modal, 400);
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--cwe-radius-md, 8px);
    transition: background-color var(--cwe-transition-fast, 150ms);
}

.hamburger-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.hamburger-menu:focus-visible {
    outline: 2px solid var(--cwe-primary, #2271b1);
    outline-offset: 2px;
}

/* Hamburger box container */
.hamburger-box {
    width: 24px;
    height: 24px;
    display: inline-block;
    position: relative;
}

/* Hamburger inner lines */
.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 24px;
    height: 2px;
    background-color: currentColor;
    border-radius: 4px;
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: '';
    display: block;
}

.hamburger-inner::before {
    top: -8px;
}

.hamburger-inner::after {
    bottom: -8px;
}

/* ============================================
   2. ANIMATED HAMBURGER TO X
   ============================================ */

/* Active state - transforms to X */
.hamburger-menu.active .hamburger-inner {
    transform: translateY(-50%) rotate(45deg);
}

.hamburger-menu.active .hamburger-inner::before {
    opacity: 0;
    transform: rotate(0deg);
}

.hamburger-menu.active .hamburger-inner::after {
    transform: translateY(16px) rotate(-90deg);
}

/* Different animation styles */
.hamburger-menu.animate-slide .hamburger-inner {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hamburger-menu.animate-elastic .hamburger-inner {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   3. MOBILE NAV OVERLAY
   ============================================ */

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--cwe-z-overlay, 300);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

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

/* ============================================
   4. MOBILE NAVIGATION PANEL
   ============================================ */

.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background-color: var(--cwe-background, #ffffff);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: var(--cwe-z-modal, 400);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panel open state */
.mobile-nav-panel.active {
    right: 0;
}

/* Panel slide from left variation */
.mobile-nav-panel.slide-left {
    right: auto;
    left: -100%;
}

.mobile-nav-panel.slide-left.active {
    left: 0;
    right: auto;
}

/* ============================================
   5. MOBILE NAV HEADER
   ============================================ */

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--cwe-background, #ffffff);
}

.mobile-logo {
    flex-shrink: 0;
}

.mobile-logo img {
    max-height: 40px;
    width: auto;
}

.mobile-site-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--cwe-heading, #1a1a1a);
}

/* Close button */
.mobile-nav-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mobile-nav-close:focus-visible {
    outline: 2px solid var(--cwe-primary, #2271b1);
    outline-offset: 2px;
}

.mobile-nav-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* ============================================
   6. MOBILE NAV CONTENT
   ============================================ */

.mobile-nav-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Mobile menu list */
.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-item {
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-menu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    text-decoration: none;
    color: var(--cwe-text, #333333);
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.mobile-menu-link:hover {
    color: var(--cwe-primary, #2271b1);
}

/* Submenu toggle button */
.submenu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
    border-radius: 4px;
    transition: transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.submenu-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.submenu-toggle.active .dashicons {
    transform: rotate(180deg);
}

/* Submenu */
.mobile-submenu {
    list-style: none;
    margin: 0;
    padding-left: 20px;
    display: none;
    overflow: hidden;
}

.mobile-submenu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.mobile-submenu .mobile-menu-item {
    border-bottom: none;
}

.mobile-submenu .mobile-menu-link {
    padding: 8px 0;
    font-size: 14px;
    font-weight: 400;
}

/* ============================================
   7. MOBILE NAV FOOTER
   ============================================ */

.mobile-nav-footer {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--cwe-background, #ffffff);
}

.mobile-social-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mobile-social-icons .social-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.mobile-social-icons .social-icon:hover {
    background-color: var(--cwe-primary, #2271b1);
    color: #ffffff;
    transform: translateY(-2px);
}

.mobile-social-icons .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ============================================
   8. BODY SCROLL LOCK
   ============================================ */

body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Restore scroll position when menu closes */
body.mobile-menu-open {
    top: 0;
    left: 0;
    right: 0;
}

/* ============================================
   9. ANIMATIONS
   ============================================ */

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

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

/* Menu item animations */
.mobile-menu-item {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

.mobile-menu-item:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu-item:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu-item:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu-item:nth-child(4) { animation-delay: 0.2s; }
.mobile-menu-item:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu-item:nth-child(6) { animation-delay: 0.3s; }
.mobile-menu-item:nth-child(7) { animation-delay: 0.35s; }
.mobile-menu-item:nth-child(8) { animation-delay: 0.4s; }
.mobile-menu-item:nth-child(9) { animation-delay: 0.45s; }
.mobile-menu-item:nth-child(10) { animation-delay: 0.5s; }

/* ============================================
   10. RESPONSIVE BREAKPOINTS
   ============================================ */

/* Show hamburger on mobile/tablet */
@media (max-width: 1024px) {
    .hamburger-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide desktop navigation on mobile */
    .main-navigation {
        display: none;
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 1025px) {
    .mobile-nav-overlay,
    .mobile-nav-panel {
        display: none;
    }
}

/* Mobile menu adjustments for small screens */
@media (max-width: 480px) {
    .mobile-nav-panel {
        width: 100%;
        max-width: 100%;
    }
    
    .mobile-nav-header {
        padding: 15px;
    }
    
    .mobile-nav-content {
        padding: 15px;
    }
    
    .mobile-nav-footer {
        padding: 15px;
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-nav-panel {
        max-width: 60%;
    }
    
    .mobile-nav-content {
        max-height: calc(100vh - 120px);
    }
}

/* ============================================
   11. DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .mobile-nav-panel {
        background-color: #1a1a1a;
    }
    
    .mobile-nav-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-menu-item {
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }
    
    .mobile-menu-link {
        color: #e5e5e5;
    }
    
    .mobile-nav-footer {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-social-icons .social-icon {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* ============================================
   12. ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus management */
.mobile-menu-link:focus-visible,
.submenu-toggle:focus-visible,
.mobile-nav-close:focus-visible {
    outline: 2px solid var(--cwe-primary, #2271b1);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav-panel,
    .mobile-nav-overlay,
    .submenu-toggle .dashicons,
    .hamburger-inner,
    .hamburger-inner::before,
    .hamburger-inner::after {
        transition-duration: 0.01ms !important;
    }
    
    .mobile-menu-item {
        animation: none !important;
    }
    
    .mobile-submenu.active {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (forced-colors: active) {
    .mobile-nav-panel {
        border-left: 2px solid CanvasText;
    }
    
    .mobile-menu-link:focus-visible {
        outline: 2px solid CanvasText;
    }
}