/**
 * Teklly Menu Styles
 * Mobile-first approach
 */

/* ============================================
   BASE STYLES (Mobile)
   ============================================ */
.menu-list, .mobile-menu-list, .mobile-menu-header {
    --neutral-darkest:  var(--text-dark)
}

.menu-item.promo a {
    color: var(--medium-carmine) !important;
    font-weight: 600 !important;
}

/* Mobile Item Wrapper (IMG + LINK + BUTTON) */
.mobile-item-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 16px 0 rgba(0, 0, 0, 0.10);
}

.mobile-item-link {
    flex: 1;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--neutral-darkest);
    font-size: 1.125rem;
}

.mobile-item-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius) 0 0 var(--radius);
    flex-shrink: 0;
}

.mobile-item-title {
    flex: 1;
    font-size: 1.125rem;
    padding: 1rem;
}

.mobile-item-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.menu-item.is-open .mobile-item-toggle {
    transform: rotate(180deg);
}

.mobile-item-toggle svg {
    display: block;
}

/* Mobile Overlay */
.mobile-menu-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
}

.mobile-menu-wrapper.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Overlay Content */
.mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    will-change: transform;
}

.mobile-menu-wrapper.active .mobile-menu-overlay {
    transform: translateY(0);
}

/* Mobile Header */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: #daba8b;
    flex-shrink: 0;
}

.mobile-menu-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-darkest);
    padding-left: 24px;
    margin-inline: auto;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background-color: #F9F9F9;
    border-radius: 100px;
    border: none;
    font-size: 1.75rem;
    color: var(--neutral-darkest);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Mobile Tabs */
.mobile-menu-tabs {
    display: flex;
    border-bottom: 1px solid #daba8b;
    flex-shrink: 0;
}

.tab-button {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-dark);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.tab-button.active {
    font-weight: 600;
}

.tab-button.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-dark);
}

/* Mobile Content */
.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
}

.menu-tab-content {
    display: none;
    padding: 1rem;
}

.menu-tab-content.active {
    display: block;
}

/* Mobile Menu List */
.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu-list.menu-level-0 > .menu-item {
    border-bottom: 1px solid #eee;
}

/* Mobile Accordion Content */
.mobile-accordion-content {
    background: #f2f2f2;
    padding: 0.5rem;
    display: none;
}

.menu-item.is-open > .mobile-accordion-content {
    display: block;
}

.mobile-submenu {
    list-style-type: none;
    padding: 0;
    flex-direction: column;
    gap: 0.5rem;
    display: flex;
}

.mobile-submenu .menu-item {
    border-radius: var(--radius);
    background-color: #FFF;
    padding: 1rem;
}

.mobile-submenu > .menu-item > a {
    color: var(--text-dark);
    display: flex;
    font-size: 1rem;
}

.mobile-submenu > .menu-item:has(.menu-level-2) > a {
    border-bottom: 1px solid #dadada;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Mobile - Level 1 Links */
.mobile-menu-list .lvl1-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #000;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

/* Mobile - Hide descriptions */
.mobile-menu-list .lvl1-description {
    display: none;
}

/* Mobile - Level 2 */
.mobile-menu-list .menu-level-2 {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu-list .menu-level-2 > .menu-item {
    padding: 0;
}

.mobile-menu-list .menu-level-2 > .menu-item > a {
    display: block;
    color: var(--neutral-darkest);
    font-size: 1rem;
    text-decoration: none;
}

/* Mobile - Hide desktop elements */
.mobile-menu-list .megamenu-custom,
.mobile-menu-list .megamenu-footer {
    display: none;
}

/* Mobile Info Menu */
.mobile-info-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-info-menu > .menu-item {
    border-bottom: 1px solid #eee;
}

.mobile-info-menu > .menu-item > a {
    display: block;
    padding: 1rem 1.25rem;
    color: #333;
    font-size: 1rem;
    text-decoration: none;
}

/* ============================================
   DESKTOP STYLES
   ============================================ */

@media (min-width: 1024px) {
    /* Hide mobile elements */
    .mobile-menu-wrapper {
        display: none;
    }

    .mobile-item-wrapper {
        display: none;
    }

    /* Desktop Menu Container */
    .desktop-menu {
        position: relative;
        width: 100%;
    }

    /* Menu List Level 0 - Horizontal */
    .menu-list.menu-level-0 {
        display: flex;
        align-items: center;
        gap: 2rem;
        max-width: var(--page-width, 1240px);
        margin: 0 auto;
        padding: 0 1rem;
        list-style: none;
        justify-content: center;
    }

    .menu-list.menu-level-0 > .menu-item:not(.has-megamenu) {
        position: relative;
    }

    .menu-list.menu-level-0 > .menu-item > a {
        display: flex;
        align-items: center;
        padding: 0.25rem 0;
        color: #FFF;
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: color 0.2s ease;
    }

    .menu-list.menu-level-0 > .menu-item.has-megamenu > a::after {
        content: "▼";
        display: inline-block;
        margin: 0 0 0.25rem 0.5rem;
        font-size: 0.65em;
        transition: transform 0.3s ease;
    }

    .menu-item.has-megamenu:hover > a::after,
    .menu-item.has-megamenu:focus-within > a::after {
        transform: rotate(180deg);
    }

    .menu-list.menu-level-0 > .menu-item:not(.has-megamenu):has(.dropdown-menu) > a::after {
        content: "▼";
        display: inline-block;
        margin-left: 0.5rem;
        font-size: 0.65em;
        transition: transform 0.3s ease;
    }

    .menu-list.menu-level-0 > .menu-item:not(.has-megamenu):has(.dropdown-menu):hover > a::after,
    .menu-list.menu-level-0 > .menu-item:not(.has-megamenu):has(.dropdown-menu):focus-within > a::after {
        transform: rotate(180deg);
    }

    /* Mega Menu Container */
    .megamenu-container {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: var(--page-width, 1240px);
        max-width: 100%;
        margin: 0 auto;
        background: #fff;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        border-radius: var(--radius);
        padding: 1.5rem;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
        transform: translateY(-10px);
        z-index: 1000;
        will-change: opacity, transform;
    }

    .menu-item.has-megamenu:hover > .megamenu-container,
    .menu-item.has-megamenu:focus-within > .megamenu-container {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    /* Mega Menu Grid */
    .megamenu-grid {
        display: grid;
        align-items: start;
    }

    .megamenu-column {
        padding: 0.5rem;
        border-right: 1px solid #f2f2f2;
    }

    /* Level 1 Link */
    .lvl1-link {
        display: block;
        color: var(--neutral-darkest);
        font-size: 1rem;
        font-weight: 600;
        text-transform: uppercase;
        text-decoration: none;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #dadada;
        transition: color 0.2s ease;
    }

    a.lvl1-link:hover {
        color: #666;
    }

    span.lvl1-link {
        cursor: default;
    }

    a.lvl1-link {
        cursor: pointer;
    }

    /* Level 1 Description */
    .lvl1-description {
        margin: 0 0 1rem 0;
        color: #666;
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* Menu Level 2 */
    .menu-level-2 {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .menu-level-2 > .menu-item:not(:last-child) {
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #f2f2f2;
    }

    .menu-level-2 > .menu-item:last-child {
        margin-bottom: 0;
    }

    .menu-level-2 > .menu-item > a {
        display: block;
        color: var(--neutral-darkest);
        font-weight: 500;
        font-size: 1rem;
        line-height: 1.5rem;
        text-decoration: none;
        transition: color 0.2s ease;
    }

    .menu-level-2 > .menu-item > a:hover {
        color: #000;
        text-decoration: underline;
    }

    .lvl2-description {
        font-size: 0.75rem;
        color: var(--neutral-dark);
        line-height: 1.3rem;
        margin-top: 0.25rem;
    }

    /* Mega Menu Custom Column */
    .megamenu-custom {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem;
        margin: 1rem auto 0;
        border-radius: var(--radius);
        height: 100%;
    }

    .megamenu-custom-image {
        width: 100%;
        margin-bottom: 1rem;
        border-radius: 8px;
        overflow: hidden;
        object-fit: cover;
    }

    .megamenu-custom-image img {
        width: 100%;
        height: 100%;
        display: block;
    }

    .megamenu-custom-title {
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--neutral-darkest);
    }

    .megamenu-custom-description {
        font-size: 0.875rem;
        color: var(--neutral-darkest);
        line-height: 1.5;
    }

    .megamenu-custom-button {
        display: inline-block;
        padding: 0.55rem 1.25rem 0.25rem;
        background-color: #C99A54;
        color: #fff;
        font-size: 1rem;
        text-decoration: none;
        border-radius: var(--radius);
        border: 1px solid #C99A54;
        transition: background 0.2s ease;
        margin-top: 1rem;
    }

    .megamenu-custom-button:hover {
        background-color: #FFF;
        color: #C99A54;
        text-decoration-line: none;
    }

    /* Mega Menu Footer */
    .megamenu-footer {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .megamenu-footer-title {
        font-size: 1rem;
        font-weight: 600;
        color: #000;
        margin-bottom: 0.5rem;
    }

    .megamenu-footer-description {
        color: #666;
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .megamenu-footer-button {
        display: flex;
        height: fit-content;
        padding: 0.55rem 1rem 0.25rem;
        background-color: var(--neutral-darkest);
        color: #FFF;
        border: 1px solid var(--neutral-darkest);
        font-size: 1rem;
        font-weight: 500;
        text-decoration: none;
        border-radius: var(--radius);
        transition: background 0.2s ease;
    }

    .megamenu-footer-button:hover {
        background-color: #FFF;
        color: var(--neutral-darkest);
    }
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: -55px;
    width: 250px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    z-index: 1000;
    will-change: opacity, transform;
}

.menu-item:not(.has-megamenu):hover > .dropdown-menu,
.menu-item:not(.has-megamenu):focus-within > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Mega Menu - Grouped Column */
.megamenu-column-grouped {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lvl1-link-grouped {
    display: block;
    color: #333;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lvl1-link-grouped:hover {
    color: #000;
}

span.lvl1-link-grouped {
    cursor: default;
}

a.lvl1-link-grouped {
    cursor: pointer;
}