/* =======================================================
   CUSTOM MENU CSS - VERSIUNE FINALĂ v10.0
   SUPRASCRIE COMPLET template.css VECHI
   Fixes:
   - Visible submenu arrows on mobile/tablet
   - Smooth arrow rotation animation
   - Better click targets
   ======================================================= */

/* -------------------------------------------------
   RESET COMPLET - Suprascrie Joomla vechi
   ------------------------------------------------- */
div#top_menu,
#topnav,
#topnav ul,
#topnav ul li,
#topnav ul li a,
#topnav ul li ul,
#topnav ul li ul li,
#topnav ul li ul li a {
    all: unset !important;
    box-sizing: border-box !important;
}

/* -------------------------------------------------
   DESKTOP (min-width: 981px)
   ------------------------------------------------- */
@media screen and (min-width: 981px) {

    /* === Container meniu - FUNDAL ALBASTRU === */
    div#top_menu {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 980px !important;
        height: 54px !important;
        margin: 0 auto !important;
        padding: 0 !important;
        border: none !important;
        position: relative !important;
        z-index: 100 !important;
    }

    #topnav {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: auto !important;
        height: 54px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* === Lista principală === */
    #topnav ul {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 54px !important;
        gap: 0 !important;
    }

    #topnav ul li {
        display: inline-block !important;
        position: relative !important;
        height: 54px !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
    }

    #topnav ul li a {
        display: block !important;
        padding: 14px 15px !important;
        height: 40px !important;
        line-height: 26px !important;
        color: #FFFFFF !important;
        font-weight: bold !important;
        text-decoration: none !important;
        transition: background-color 0.3s ease !important;
        white-space: nowrap !important;
    }

    #topnav ul li a:hover {
        background-color: #001320 !important;
        color: #FFFFFF !important;
    }

    /* === Submeniuri dropdown === */
    #topnav ul li ul {
        display: none !important;
        position: absolute !important;
        top: 54px !important;
        left: 0 !important;
        width: 277px !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #eeba30 !important;
        border: 1px solid #eeba30 !important;
        box-shadow: 0 4px 12px #eeba30 !important;
        z-index: 9999 !important;
        list-style: none !important;
    }

    #topnav ul li:hover > ul {
        display: block !important;
    }

    #topnav ul li ul li {
        display: block !important;
        width: 277px !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        border-top: 1px solid #eeba30!important;
    }

    #topnav ul li ul li:first-child {
        border-top: none !important;
    }

    #topnav ul li ul li a {
        display: block !important;
        width: 277px !important;
        height: auto !important;
        padding: 9px 10px !important;
        color: #000000 !important;
        background: #eeba30 !important;
        font-weight: normal !important;
        line-height: 1.4 !important;
    }

    #topnav ul li ul li a:hover {
        background: #eeba30 !important;
        color: #FFFFFF !important;
    }

    /* === Sub-submeniuri (nivel 3) === */
    #topnav ul li ul ul {
        top: 0 !important;
        left: 277px !important;
        margin: -1px 0 0 0 !important;
    }

    #topnav ul li ul li:hover > ul {
        display: block !important;
    }

    /* === Ascunde elemente mobile === */
    .mobile-menu-toggle,
    .menu-overlay,
    .submenu-arrow {
        display: none !important;
    }
}

/* -------------------------------------------------
   MOBILE & TABLET (max-width: 980px)
   ------------------------------------------------- */
@media screen and (max-width: 980px) {

    /* === Buton hamburger === */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
        background: #02243c !important;
        border: none !important;
        border-radius: 8px !important;
        z-index: 100003 !important; /* HIGHEST - above menu panel */
        cursor: pointer !important;
        padding: 10px !important;
        box-shadow: 0 4px 15px #02243c !important;
        pointer-events: auto !important;
        transition: background 0.3s ease !important;
    }

    .mobile-menu-toggle span {
        display: block !important;
        width: 28px !important;
        height: 3px !important;
        background: #fff !important;
        margin: 5px auto !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }

    .mobile-menu-toggle.active {
        background: #ff0000 !important;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px) !important;
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0 !important;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px) !important;
    }

    /* === Panel meniu === */
    div#top_menu {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 350px !important;
        height: 100vh !important;
        background: #02243c !important;
        z-index: 100001 !important; /* Below hamburger */
        transition: right 0.4s ease !important;
        overflow-y: auto !important;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3) !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    div#top_menu.active {
        right: 0 !important;
    }

    /* === Overlay === */
    .menu-overlay {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.6) !important;
        z-index: 100000 !important;
    }

    .menu-overlay.active {
        display: block !important;
    }

    /* === Container nav === */
    #topnav {
        display: block !important;
        width: 100% !important;
        padding: 80px 0 40px 0 !important;
        height: auto !important;
        margin: 0 !important;
    }

    /* === Lista verticală === */
    #topnav ul {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }

    #topnav ul li {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        position: relative !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
    }

    /* Links - clickable to toggle submenus */
    #topnav ul li a {
        display: block !important;
        width: calc(100% - 55px) !important; /* Leave space for arrow */
        height: auto !important;
        padding: 18px 20px !important;
        color: #FFFFFF !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        background: transparent !important;
        line-height: 1.4 !important;
        cursor: pointer !important;
    }

    #topnav ul li a:hover {
        background: rgba(74, 144, 226, 0.05) !important;
    }

    /* VISIBLE ARROW DIV (added by JS) */
    .submenu-arrow {
        display: flex !important;
        position: absolute !important;
        right: 0 !important;
        top: 0 !important;
        width: 55px !important;
        height: 55px !important;
        align-items: center !important;
        justify-content: center !important;
        color: #FFFFFF !important;
        font-size: 20px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        cursor: pointer !important;
        z-index: 10 !important;
        border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .submenu-arrow .arrow-icon {
        display: inline-block !important;
        transition: transform 0.3s ease !important;
    }

    .submenu-arrow.active .arrow-icon {
        transform: rotate(90deg) !important;
    }

    /* Hide CSS ::after arrows since we use visible divs */
    #topnav ul li.has-submenu > a::after {
        display: none !important;
        content: none !important;
    }

    /* === Submeniuri accordion === */
    #topnav ul li ul {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-height: 0 !important;
        overflow: hidden !important;
        background: #eeba30 !important;
        margin: 0 !important;
        padding: 0 !important;
        transition: max-height 0.3s ease-in-out !important;
        border: none !important;
        box-shadow: none !important;
        list-style: none !important;
        left: 0 !important;
        top: auto !important;
    }

    #topnav ul li.submenu-open > ul {
        max-height: 800px !important;
    }

    #topnav ul li ul li {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
    }

    #topnav ul li ul li a {
        display: block !important;
        width: 100% !important;
        padding: 16px 20px 16px 35px !important;
        color: #FFFFFF !important;
        font-size: 15px !important;
        background: transparent !important;
        line-height: 1.4 !important;
    }

    #topnav ul li ul li a:hover {
        background: #eeba30 !important;
    }

    /* === Sub-submeniuri (nivel 3) === */
    #topnav ul li ul li.has-submenu > a {
        width: calc(100% - 55px) !important; /* Leave space for nested arrow */
    }

    #topnav ul li ul ul {
        background: #eeba30 !important;
        position: static !important;
        left: 0 !important;
        top: auto !important;
        width: 100% !important;
    }

    #topnav ul li ul ul li a {
        padding-left: 50px !important;
        font-size: 14px !important;
    }

    /* === Blocare scroll === */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
}

/* -------------------------------------------------
   FIX pentru coloane pe Desktop (981px+)
   ------------------------------------------------- */
@media screen and (min-width: 981px) {
    #leftcolumn {
        display: block !important;
        visibility: visible !important;
        float: left !important;
        width: 205px !important;
        margin-left: 9px !important;
    }

    #rightcolumn {
        display: block !important;
        visibility: visible !important;
        float: right !important;
        width: 205px !important;
        margin-right: 9px !important;
    }

    #maincolumn {
        float: left !important;
        width: 530px !important;
    }

    #maincolumn_middle {
        float: left !important;
        width: 740px !important;
    }

    #maincolumn_big {
        float: left !important;
        width: 967px !important;
    }
}