/* =====================================================
   NovaUI Premium Navigation v2 — Frontend CSS
   Desktop menu renders inline via shortcode.
   No header injection — you control the wrapper.
===================================================== */

/* ── Scoped reset ── */
.novaui-desktop-menu *,
.novaui-hamburger *,
.novaui-mobile-panel *,
.novaui-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── CSS Variables (defaults; overridden by PHP inline) ── */
:root {
    --novaui-accent:      #6366f1;
    --novaui-accent2:     #a855f7;
    --novaui-slide-start: -100%;
    --novaui-logo-width:  140px;
}

/* =====================================================
   DESKTOP MENU
===================================================== */
ul.novaui-desktop-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 8px;
    padding: 0;
    margin: 0;
}

ul.novaui-desktop-menu li {
    position: relative;
    list-style: none;
}

/* Top-level links */
ul.novaui-desktop-menu > li > a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #334155;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: color 0.3s ease, transform 0.3s ease;
}

/* Animated underline — slides in from left on hover */
ul.novaui-desktop-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 6px;          /* sits inside the bottom padding */
    left: 18px;           /* aligns with the text start */
    right: 18px;          /* aligns with the text end */
    height: 2px;
    background: linear-gradient(90deg, var(--novaui-accent, #6366f1), var(--novaui-accent2, #a855f7));
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

ul.novaui-desktop-menu > li:hover > a::after,
ul.novaui-desktop-menu > li.current-menu-item > a::after,
ul.novaui-desktop-menu > li.current-menu-ancestor > a::after {
    transform: scaleX(1);
}

ul.novaui-desktop-menu > li:hover > a {
    color: #111827;
    transform: translateY(-2px);
}

/* Active/current page — underline always visible */
ul.novaui-desktop-menu > li.current-menu-item > a,
ul.novaui-desktop-menu > li.current-menu-ancestor > a {
    color: var(--novaui-accent, #6366f1);
}

/* =====================================================
   SUBMENUS — Level 1 / 2 / 3
===================================================== */
ul.novaui-desktop-menu .submenu {
    position: absolute;
    top: 110%;
    left: 0;
    width: 250px;
    background: #fff;
    border-radius: 22px;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    list-style: none;
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
    z-index: 10000;
}

ul.novaui-desktop-menu li:hover > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

ul.novaui-desktop-menu .submenu li {
    position: relative;
    list-style: none;
}

ul.novaui-desktop-menu .submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    padding: 14px 16px;
    border-radius: 14px;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

ul.novaui-desktop-menu .submenu a:hover {
    background: #f1f5f9;
    color: #111827;
    transform: translateX(4px);
}

/* Nested submenus fly out to the right */
ul.novaui-desktop-menu .submenu .submenu {
    top: 0;
    left: 104%;
}

/* ── Chevron arrows (SVG) ── */
.arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.25s ease;
}

/* Down chevron rotates 180° when the submenu is open */
.arrow--down {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

ul.novaui-desktop-menu > li:hover > a .arrow--down {
    transform: rotate(180deg);
    opacity: 1;
}

ul.novaui-desktop-menu > li:hover > a .arrow {
    opacity: 1;
}

.arrow svg {
    display: block;
}


/* =====================================================
   HAMBURGER BUTTON
===================================================== */
.novaui-hamburger {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: #fff;
    border-radius: 16px;
    cursor: pointer;
    /* Hidden on desktop, shown on mobile via media query */
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.35s ease;
    flex-shrink: 0;
}

.novaui-hamburger:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.novaui-hamburger span {
    position: relative;
    width: 22px;
    height: 2px;
    background: #111827;
    border-radius: 30px;
    display: block;
    transition: all 0.35s ease;
}

.novaui-hamburger span::before,
.novaui-hamburger span::after {
    content: '';
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: #111827;
    border-radius: 30px;
    transition: all 0.35s ease;
}

.novaui-hamburger span::before { top: -7px; }
.novaui-hamburger span::after  { top:  7px; }

/* Active X state */
.novaui-hamburger.is-active span             { background: transparent; }
.novaui-hamburger.is-active span::before     { top: 0; transform: rotate(45deg);  }
.novaui-hamburger.is-active span::after      { top: 0; transform: rotate(-45deg); }

/* =====================================================
   MOBILE SLIDE PANEL
===================================================== */
.novaui-mobile-panel {
    position: fixed;
    top: 0;
    width: 340px;
    height: 100vh;
    background: #ffffff;
    z-index: 99998;
    padding: 30px 24px 40px;
    overflow-y: auto;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.novaui-mobile-panel.novaui-slide-left {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(15, 23, 42, 0.06);
    transform: translateX(-100%);
}

.novaui-mobile-panel.novaui-slide-right {
    right: 0;
    left: auto;
    border-left: 1px solid rgba(15, 23, 42, 0.06);
    transform: translateX(100%);
}

.novaui-mobile-panel.is-open {
    transform: translateX(0);
}

/* ── Panel Header (logo row only — close btn is now absolute on the panel) ── */
.novaui-panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    min-height: 56px;
    /* Right padding keeps logo text from sliding under the close button */
    padding-right: 56px;
}

.novaui-panel-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 16px 0 20px;
}

/* ── Close Button ── anchored top-right of the fixed panel ── */
.novaui-close-btn {
    position: absolute; /* panel is position:fixed — absolute children anchor to it */
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: #f8fafc;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    z-index: 99999; /* above everything inside the panel */
    line-height: 1;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.novaui-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
    transform: rotate(90deg) scale(1.08);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

/* ── Mobile Logo ── */
.novaui-mobile-logo {
    display: block;
    text-decoration: none;
    flex: 1;
}

.novaui-mobile-logo--text {
    font-size: 15px;        /* smaller so long site names don't wrap */
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #111827;
    font-family: 'Inter', sans-serif;
    word-break: break-word; /* safety net for very long domain names */
}

.novaui-mobile-logo-img {
    width: var(--novaui-logo-width);
    height: auto;
    display: block;
}

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

ul.novaui-mobile-menu-list li {
    margin-bottom: 6px;
    list-style: none;
}

ul.novaui-mobile-menu-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: #334155;
    background: #fff;
    padding: 15px 18px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

ul.novaui-mobile-menu-list a:hover {
    background: #f1f5f9;
    transform: translateX(4px);
    color: #111827;
}

.novaui-toggle-icon {
    font-size: 18px;
    font-weight: 400;
    color: #94a3b8;
    line-height: 1;
    transition: transform 0.3s ease, color 0.3s ease;
}

.novaui-submenu-toggle.is-open .novaui-toggle-icon {
    transform: rotate(45deg);
    color: var(--novaui-accent);
}

/* ── Mobile sub-menus — smooth height transition ── */
ul.novaui-mobile-submenu {
    overflow: hidden;
    padding-left: 14px;
    list-style: none;
    /* height is set by JS for smooth animation */
    height: 0;
    transition: height 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
    opacity: 0;
}

ul.novaui-mobile-submenu.is-open {
    opacity: 1;
    /* height set dynamically by JS */
}

/* =====================================================
   OVERLAY
===================================================== */
.novaui-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    z-index: 99997;
    transition: all 0.35s ease;
}

.novaui-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   RESPONSIVE — show hamburger, hide desktop menu
===================================================== */
@media ( max-width: 992px ) {

    ul.novaui-desktop-menu {
        display: none !important;
    }

    .novaui-hamburger {
        display: flex !important;
    }

}

@media ( min-width: 993px ) {

    .novaui-hamburger {
        display: none !important;
    }

    .novaui-mobile-panel,
    .novaui-overlay {
        display: none !important;
    }

}
