/* Mobile Menu Accordion Styles - Proper Hierarchy and Inheritance */

/* Accordion Container */
.mobile-menu-accordion {
    width: 100%;
    border-bottom: 1px solid var(--border);
}

/* Accordion Toggle Button - INHERIT from parent menu items */
.mobile-menu-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    background: none;
    border: none;
    /* INHERIT typography - do NOT override */
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 12px;
}

/* Services text wrapper for centering */
.mobile-menu-accordion-toggle span:first-child {
    flex: 1;
    text-align: center;
    /* Inherit parent typography */
    font-size: inherit;
    font-weight: inherit;
}

.mobile-menu-accordion-toggle:active {
    opacity: 0.7;
}

/* Accordion Icon - Right aligned, doesn't affect text */
.accordion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
}

/* Icon rotation when expanded */
.mobile-menu-accordion-toggle.expanded .accordion-icon {
    transform: rotate(45deg);
}

/* Accordion Content */
.mobile-menu-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.mobile-menu-accordion-content.expanded {
    opacity: 1;
}

/* Submenu Items - Relative sizing for clear hierarchy */
.mobile-submenu-item {
    display: flex;
    align-items: center;
    padding: 0.75em 0 0.75em 1.5em;
    margin: 0;
    color: var(--text-light);
    text-decoration: none;
    /* Use relative sizing (em) based on parent font-size */
    font-size: 0.875em;
    font-weight: 400;
    line-height: 1.5;
    transition: all 0.2s ease;
    min-height: 44px;
    border-left: 3px solid transparent;
}

.mobile-submenu-item:active {
    background-color: var(--muted);
    color: var(--accent);
    border-left-color: var(--accent);
}

/* Spacing between submenu items */
.mobile-submenu-item + .mobile-submenu-item {
    margin-top: 0;
}

/* Mobile Menu Adjustments */
@media (max-width: 1023px) {
    .mobile-menu {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .mobile-menu > a,
    .mobile-menu > .btn {
        padding: 14px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Ensure Services accordion matches other menu items */
    .mobile-menu-accordion {
        display: flex;
        flex-direction: column;
    }

    .mobile-menu-accordion-toggle {
        padding: 14px 0;
        min-height: 44px;
        justify-content: center;
        position: relative;
        /* INHERIT typography from parent */
        font-size: inherit;
        font-weight: inherit;
        color: inherit;
    }

    .mobile-menu-accordion-toggle span:first-child {
        flex: 1;
        text-align: center;
        /* Inherit parent typography */
        font-size: inherit;
        font-weight: inherit;
    }

    .accordion-icon {
        position: absolute;
        right: 0;
        margin-left: 0;
    }

    .mobile-menu-accordion {
        margin: 0;
        border: none;
        border-bottom: 1px solid var(--border);
    }

    /* Ensure smooth transitions */
    .mobile-menu-accordion-content {
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    }

    /* Clean spacing */
    .mobile-menu > a:first-child {
        margin-top: 0;
    }

    .mobile-menu .btn {
        margin-top: 12px;
    }

    /* Submenu items use relative sizing */
    .mobile-submenu-item {
        padding: 0.75em 0 0.75em 1.5em;
        font-size: 0.875em;
        font-weight: 400;
        min-height: 44px;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .mobile-menu-accordion-toggle {
        padding: 16px 0;
        min-height: 48px;
    }

    .mobile-submenu-item {
        min-height: 48px;
        padding: 0.875em 0 0.875em 1.5em;
    }
}

/* Animation for smooth expand/collapse */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-accordion-content.expanded .mobile-submenu-item {
    animation: slideDown 0.3s ease forwards;
}

.mobile-submenu-item:nth-child(1) {
    animation-delay: 0s;
}

.mobile-submenu-item:nth-child(2) {
    animation-delay: 0.05s;
}

.mobile-submenu-item:nth-child(3) {
    animation-delay: 0.1s;
}

.mobile-submenu-item:nth-child(4) {
    animation-delay: 0.15s;
}
