/**
 * Main Menu Styles
 * Responsive navigation menu with dropdowns
 */

/* ============================================
   Site Header - Universal Red Background
   ============================================ */

.site-header {
    background: #b91c1c !important;
    border-bottom: none !important;
    padding: 1rem 0 !important;
    width: 100% !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.site-header .container {
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

.site-header-content {
    padding: 0 !important;
    gap: 0 !important;
}

/* ============================================
   Base Menu Styles
   ============================================ */

.main-menu {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #b91c1c;
    padding: 0;
    border-radius: 0;
    margin: 0;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    border-radius: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.menu-link.active,
.menu-item.is-active>.menu-link {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.15);
    font-weight: 600;
}

.menu-link i {
    font-size: 1.05rem;
}

.menu-text {
    flex: 1;
}

.menu-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

.menu-link.active .menu-count,
.menu-item.is-active>.menu-link .menu-count {
    background-color: #fbbf24;
    color: #0f172a;
}

.menu-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.menu-item.has-children.is-expanded .menu-arrow,
.menu-item.has-children:hover .menu-arrow {
    transform: rotate(180deg);
}

/* ============================================
   Dropdown Styles
   ============================================ */

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    max-width: 300px;
    width: max-content;
    background: #b91c1c;
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 0;
    overflow: hidden;
}

.menu-item.has-children:hover .menu-dropdown,
.menu-item.has-children.is-expanded .menu-dropdown,
.menu-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-dropdown .menu-item {
    width: 100%;
    display: block;
    margin: 0;
    padding: 0;
}

.menu-dropdown .menu-link {
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    font-size: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    color: #ffffff;
    display: flex;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-dropdown .menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.menu-dropdown .menu-link.active,
.menu-dropdown .menu-item.is-active>.menu-link {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.15);
    font-weight: 600;
}

/* Nested Dropdown (Sub-dropdown) */
.menu-dropdown .menu-dropdown {
    top: 0;
    left: 100%;
    margin-left: 0;
    margin-top: 0;
    background: #991b1b;
    min-width: 200px;
    max-width: 280px;
    overflow: hidden;
}

.menu-dropdown .menu-item.has-children:hover .menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

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

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle-icon {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.menu-toggle-icon span {
    width: 100%;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 1024px) {
    .menu-list {
        gap: 0.25rem;
    }

    .menu-link {
        padding: 0.625rem 0.75rem;
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .main-menu {
        width: 100%;
    }

    .menu-toggle {
        display: flex;
    }

    .menu-list {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background: #b91c1c;
        flex-direction: column;
        align-items: stretch;
        padding: 4rem 0 2rem;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 1000;
        gap: 0;
    }

    .main-menu.menu-open .menu-list {
        right: 0;
    }

    /* Overlay when menu is open */
    .main-menu.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .menu-link {
        width: 100%;
        padding: 1.25rem 1.5rem;
        justify-content: space-between;
        border-radius: 0;
        font-size: 1.1rem;
        color: #ffffff;
    }

    .menu-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .menu-link.active,
    .menu-item.is-active>.menu-link,
    .menu-item.has-active-child>.menu-link {
        color: #fbbf24;
        background-color: rgba(251, 191, 36, 0.15);
        font-weight: 600;
    }

    .menu-dropdown {
        position: static;
        width: 100%;
        min-width: auto;
        background: #991b1b;
        border: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        padding: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .menu-item.has-children.is-expanded .menu-dropdown,
    .menu-dropdown.is-open {
        max-height: 1000px;
    }

    .menu-dropdown .menu-link {
        padding-left: 2.5rem;
        font-size: 1rem;
    }

    .menu-dropdown .menu-dropdown .menu-link {
        padding-left: 3.5rem;
        font-size: 0.95rem;
    }

    .menu-arrow {
        transform: rotate(-90deg);
    }

    .menu-item.has-children.is-expanded .menu-arrow {
        transform: rotate(0deg);
    }

    .menu-count {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .menu-list {
        width: 100%;
        max-width: 100vw;
    }
}

/* ============================================
   Active State Enhancements
   ============================================ */

.menu-item.is-active>.menu-link {
    color: #fbbf24;
    font-weight: 600;
}

.menu-item.is-active>.menu-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background-color: #fbbf24;
}

/* Parent item gets active style when child is active */
.menu-item.has-children.has-active-child>.menu-link,
.menu-item.has-children.is-active>.menu-link {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.15);
    font-weight: 600;
}

@media (max-width: 768px) {
    .menu-item.is-active>.menu-link::after {
        left: 0;
        right: 0;
    }
}

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

.menu-link:focus,
.menu-toggle:focus {
    outline: 2px solid var(--primary, #dc2626);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}