﻿/* ============================================================
   Interactive Menu Widget — mstech-plugin
   ============================================================ */

/* ----------------------------------------------------------
   Wrapper & Container
   ---------------------------------------------------------- */
.mg-interactive-menu-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

.mg-menu {
    width: 100%;
    position: relative;
    overflow: visible;
}

.mg-menu.horizontal {
    display: flex;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    padding: 0 10px;
}

.mg-menu.vertical {
    display: block;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

/* ----------------------------------------------------------
   Menu List
   ---------------------------------------------------------- */
.mg-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.mg-menu.vertical .mg-menu-list {
    flex-direction: column;
}

/* ----------------------------------------------------------
   Menu Item
   ---------------------------------------------------------- */
.mg-menu-item {
    position: relative;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
    overflow: visible !important;
}

.mg-menu-item > a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    color: #fff;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.3px;
    border-radius: 6px;
    position: relative;
    padding: 12px 20px;
    overflow: hidden;
}

/* shimmer overlay on hover */
.mg-menu-item > a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mg-menu-item > a:hover::before {
    opacity: 1;
}

/* ------ Hover Effect Variants ------ */

/* underline */
.mg-hover-underline .mg-menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: width 0.3s ease, left 0.3s ease;
}
.mg-hover-underline .mg-menu-item > a:hover::after,
.mg-hover-underline .mg-menu-item.current-menu-item > a::after {
    width: calc(100% - 40px);
    left: 20px;
}

/* top-border */
.mg-hover-top-border .mg-menu-item > a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    border-radius: 0 0 3px 3px;
    transition: background 0.3s ease;
}
.mg-hover-top-border .mg-menu-item > a:hover::after,
.mg-hover-top-border .mg-menu-item.current-menu-item > a::after {
    background: rgba(255, 255, 255, 0.6);
}

/* bottom-border */
.mg-hover-bottom-border .mg-menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    border-radius: 3px 3px 0 0;
    transition: background 0.3s ease;
}
.mg-hover-bottom-border .mg-menu-item > a:hover::after,
.mg-hover-bottom-border .mg-menu-item.current-menu-item > a::after {
    background: rgba(255, 255, 255, 0.7);
}

/* glow */
.mg-hover-glow .mg-menu-item > a:hover {
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.28);
}

/* ----------------------------------------------------------
   Dividers between horizontal menu items
   ---------------------------------------------------------- */
.mg-menu-divider.mg-menu.horizontal .mg-menu-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

/* ----------------------------------------------------------
   Icon
   ---------------------------------------------------------- */
.mg-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease, color 0.3s ease;
    font-size: 16px;
    width: 18px;
    height: 18px;
}

.mg-menu-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.mg-menu-item > a:hover .mg-menu-icon {
    transform: scale(1.15);
}

.mg-submenu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    transition: transform 0.3s ease;
}

/* ----------------------------------------------------------
   Submenu — shared
   ---------------------------------------------------------- */
.mg-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    min-width: 240px;
    overflow: visible !important;
    transform: translateY(6px);
    border-top: 3px solid #3498db;
}

/* Visible state */
.mg-menu-item.trigger-hover:hover > .mg-submenu.level-1,
.mg-submenu-item.trigger-hover:hover > .mg-submenu.level-2,
.mg-menu-item.trigger-click.active > .mg-submenu.level-1,
.mg-submenu-item.trigger-click.active > .mg-submenu.level-2 {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Items fade in with parent submenu */
.mg-menu-item.trigger-hover:hover > .mg-submenu.level-1 > .mg-submenu-item > a,
.mg-submenu-item.trigger-hover:hover > .mg-submenu.level-2 > li > a,
.mg-menu-item.trigger-click.active > .mg-submenu.level-1 > .mg-submenu-item > a,
.mg-submenu-item.trigger-click.active > .mg-submenu.level-2 > li > a {
    opacity: 1;
}

/* Horizontal: level-1 drops below */
.mg-menu.horizontal .mg-submenu.level-1 {
    top: 100%;
    margin-top: 8px;
}

/* Vertical: level-1 expands inline */
.mg-menu.vertical .mg-submenu.level-1 {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.06);
    box-shadow: none;
    border-radius: 0;
    border-top: none;
    min-width: 0;
}

.mg-menu.vertical .mg-menu-item.has-submenu.active > .mg-submenu.level-1 {
    display: block;
}

/* ----------------------------------------------------------
   Submenu Item
   ---------------------------------------------------------- */
.mg-submenu-item {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: visible !important;
}

.mg-submenu-item > a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    color: #2c3e50;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 16px;
    position: relative;
    border-left: 3px solid transparent;
    gap: 8px;
    opacity: 0;
}

.mg-submenu-item > a:hover {
    background-color: #f0f4f8;
    border-left-color: #3498db;
    color: #1a252f;
    padding-left: 20px;
}

/* Arrow indicator for items that have a level-2 submenu */
.mg-submenu-item.has-submenu-2 > a::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 2px solid #3498db;
    border-bottom: 2px solid #3498db;
    margin-left: auto;
    flex-shrink: 0;
    transform: rotate(-45deg);
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.mg-submenu-item.has-submenu-2 > a:hover::after {
    border-color: #2980b9;
    transform: rotate(-45deg) translateX(2px);
}

/* ----------------------------------------------------------
   Level-2 Submenu
   ---------------------------------------------------------- */
.mg-submenu.level-2 {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 6px;
    margin-top: 0;
    z-index: 10000 !important;
    transform: translateX(6px);
    border-top: 3px solid #e74c3c;
    min-width: 220px;
}

.mg-submenu.level-2 li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mg-submenu.level-2 a {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    opacity: 0;
}

.mg-submenu.level-2 a:hover {
    background-color: #fdf2f2;
    border-left-color: #e74c3c;
    color: #c0392b;
    padding-left: 20px;
}

/* Vertical: level-2 inline */
.mg-menu.vertical .mg-submenu.level-2 {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin: 0 0 0 20px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    border-top: none;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    min-width: 0;
}

.mg-menu.vertical .mg-submenu-item.has-submenu-2.active > .mg-submenu.level-2 {
    display: block;
}

/* ----------------------------------------------------------
   Click-trigger dropdown arrows (vertical layout)
   ---------------------------------------------------------- */
.mg-menu.vertical .mg-menu-item.trigger-click > a::after,
.mg-menu.vertical .mg-submenu-item.trigger-click > a::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    margin-left: auto;
    flex-shrink: 0;
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}

/* Override level-2 parent arrow when in vertical+click mode */
.mg-menu.vertical .mg-submenu-item.trigger-click.has-submenu-2 > a::after {
    border-color: currentColor;
}

.mg-menu.vertical .mg-menu-item.trigger-click.has-submenu.active > a::after,
.mg-menu.vertical .mg-submenu-item.trigger-click.has-submenu-2.active > a::after {
    transform: rotate(45deg);
}

/* Horizontal items with click trigger — subtle caret */
.mg-menu.horizontal .mg-menu-item.trigger-click.has-submenu > a .mg-menu-label::after {
    content: ' \25be';
    font-size: 10px;
    opacity: 0.7;
}

/* ----------------------------------------------------------
   Active / current-menu-item
   ---------------------------------------------------------- */
.mg-menu-item.current-menu-item > a,
.mg-menu-item.current-menu-ancestor > a {
    background: rgba(255, 255, 255, 0.15);
}

.mg-menu-item.active > a {
    background: rgba(255, 255, 255, 0.18) !important;
}

.mg-submenu-item.active > a {
    background-color: #eaf3fc;
    border-left-color: #3498db;
    color: #1a252f;
}

/* ----------------------------------------------------------
   Mobile Toggle Button
   ---------------------------------------------------------- */
.mg-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 7px;
    gap: 4px;
    z-index: 1001;
    transition: background 0.3s ease;
}

.mg-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
}

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

.mg-menu-toggle.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mg-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mg-menu-toggle.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ----------------------------------------------------------
   Responsive — 768px (Sidebar Mobile Menu)
   ---------------------------------------------------------- */
@media (max-width: 768px) {
    .mg-menu-toggle {
        display: flex;
        background: #fff;
        border: 1px solid #ddd;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 1002;
    }

    .mg-menu-toggle:hover {
        background: #f5f5f5;
    }

    .mg-menu-toggle span {
        background-color: #2c3e50;
    }

    .mg-interactive-menu-wrapper {
        position: relative;
    }

    /* Sidebar overlay backdrop */
    .mg-interactive-menu-wrapper::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9997;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
    }

    .mg-interactive-menu-wrapper.sidebar-open::before {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .mg-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: #ffffff !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
        display: block !important;
        flex-direction: column;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .mg-menu.mobile-open {
        transform: translateX(0);
    }

    /* Sidebar header with close button */
    .mg-menu::before {
        content: '';
        display: block;
        height: 60px;
        background: #2c3e50;
        border-bottom: 2px solid #e74c3c;
        flex-shrink: 0;
    }

    .mg-menu-list {
        flex-direction: column;
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
    }

    .mg-menu-item {
        width: 100%;
        border-bottom: 1px solid #eef1f4;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .mg-menu-item:last-child {
        border-bottom: none;
    }

    .mg-menu-item > a {
        width: 100%;
        padding: 16px 18px;
        color: #2c3e50 !important;
        font-weight: 500;
        border-radius: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-decoration: none;
        background: #ffffff;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .mg-menu-item > a::before {
        display: none !important;
    }

    .mg-menu-item > a:hover {
        background: #f0f4f8 !important;
        color: #2980b9 !important;
    }

    /* Arrow indicator for items with submenus */
    .mg-menu-item.has-submenu > a::after {
        content: '›' !important;
        font-size: 24px;
        color: #3498db;
        transition: transform 0.3s ease;
        margin-left: auto;
        margin-right: 0;
        padding-left: 12px;
        display: inline-block !important;
    }

    .mg-menu-item.active > a::after {
        transform: rotate(90deg);
    }

    /* Reset hover-effect decorations on mobile */
    .mg-hover-underline .mg-menu-item > a::after,
    .mg-hover-top-border .mg-menu-item > a::after,
    .mg-hover-bottom-border .mg-menu-item > a::after,
    .mg-hover-glow .mg-menu-item > a:hover {
        display: none !important;
    }

    .mg-submenu.level-1 {
        position: static !important;
        display: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #f0f4f8 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border-top: none !important;
        min-width: 100% !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .mg-menu-item.active > .mg-submenu.level-1 {
        display: block !important;
        max-height: 1000px;
    }

    .mg-submenu-item {
        width: 100%;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mg-submenu-item > a {
        padding: 13px 18px 13px 40px;
        color: #555555 !important;
        border-left: none;
        border-bottom: 1px solid #eef1f4;
        font-size: 14px;
        opacity: 1 !important;
        transition: background 0.25s ease, color 0.25s ease;
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        text-decoration: none;
        background: #f0f4f8;
    }

    .mg-submenu-item > a:hover {
        background: #e0ecf6 !important;
        color: #2980b9 !important;
    }

    .mg-submenu-item.has-submenu-2 > a::after {
        content: '›' !important;
        font-size: 20px;
        color: #3498db;
        transition: transform 0.3s ease;
        margin-left: auto;
        padding-left: 8px;
        display: inline-block !important;
    }

    .mg-submenu-item.active > a::after {
        transform: rotate(90deg);
    }

    .mg-submenu.level-2 {
        position: static !important;
        display: none !important;
        margin: 0 !important;
        background: #e8f1f9 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border-top: none !important;
        border-left: none !important;
        min-width: 100% !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .mg-submenu-item.active > .mg-submenu.level-2 {
        display: block !important;
        max-height: 1000px;
    }

    .mg-submenu.level-2 li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mg-submenu.level-2 a {
        padding: 11px 18px 11px 60px;
        font-size: 13px;
        color: #666666 !important;
        border-left: none;
        opacity: 1 !important;
        transition: background 0.25s ease, color 0.25s ease;
        display: block;
        text-decoration: none;
        background: #e8f1f9;
    }

    .mg-submenu.level-2 a:hover {
        background: #d8e5f2 !important;
        color: #2980b9 !important;
    }
}

/* ----------------------------------------------------------
   Responsive — 480px
   ---------------------------------------------------------- */
@media (max-width: 480px) {
    .mg-menu-item > a {
        font-size: 13px !important;
        padding: 11px 14px !important;
    }

    .mg-menu-icon {
        font-size: 14px !important;
        width: 16px !important;
        height: 16px !important;
    }

    .mg-submenu-item > a {
        font-size: 12px !important;
        padding: 9px 14px 9px 30px !important;
    }

    .mg-submenu.level-2 a {
        padding: 8px 14px 8px 42px !important;
    }
}

/* ----------------------------------------------------------
   Animations
   ---------------------------------------------------------- */
@keyframes mg-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes mg-slideRight {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes mg-zoomIn {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

/* Animation type classes applied to wrapper */
.mg-anim-slide .mg-submenu.level-1 { animation: mg-slideDown 0.28s ease forwards; }
.mg-anim-slide .mg-submenu.level-2 { animation: mg-slideRight 0.28s ease forwards; }
.mg-anim-zoom  .mg-submenu         { animation: mg-zoomIn 0.25s ease forwards; }
.mg-anim-fade  .mg-submenu         { animation: mg-fadeIn 0.25s ease forwards; }

/* ----------------------------------------------------------
   Accessibility
   ---------------------------------------------------------- */
.mg-menu-item > a:focus-visible,
.mg-submenu-item > a:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ----------------------------------------------------------
   Print
   ---------------------------------------------------------- */
@media print {
    .mg-menu-toggle { display: none; }

    .mg-menu {
        position: static !important;
        display: block !important;
        background: none !important;
        box-shadow: none !important;
    }

    .mg-submenu {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: none !important;
    }
}