/**
 * Modern Custom Navigation Bar
 * Responsive design with smooth animations
 * Created: October 2025
 */

/* ==========================================
   THEME OVERRIDE & RESET
   ========================================== */
.custom-navbar-wrapper ul,
.custom-navbar-wrapper li,
.custom-navbar-wrapper a {
    margin: 0;
    padding: 0;
    list-style: none;
    text-decoration: none;
}

.custom-navbar-wrapper .menu {
    display: flex !important;
    flex-direction: row !important;
}

/* Override any theme styles that might interfere */
.custom-navbar-wrapper .menu > li {
    display: inline-block !important;
    float: none !important;
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
.custom-navbar-wrapper {
    position: relative;
    width: 100%;
    z-index: 9999;
    background: #ffffff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    clear: both;
}

.custom-navbar-wrapper * {
    box-sizing: border-box;
}

.custom-navbar-wrapper.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ==========================================
   TOP BAR (Optional Info Bar)
   ========================================== */
.custom-topbar {
    background: #23a3d7;
    color: #ffffff;
    padding: 12px 0;
    font-size: 14px;
    transition: all 0.4s ease;
    max-height: 100px;
    overflow: hidden;
}

.custom-topbar.hide-topbar {
    max-height: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
}

.custom-navbar-wrapper.topbar-hidden {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.custom-topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

.topbar-info {
    display: flex;
    gap: 30px;
    align-items: center;
}

.topbar-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-weight: 400;
    font-size: 14px;
}

.topbar-info-item i {
    font-size: 15px;
    opacity: 0.95;
}

.topbar-social {
    display: flex;
    gap: 12px;
    align-items: center;
}

.topbar-social a {
    color: #ffffff;
    font-size: 15px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.topbar-social a i {
    color: #ffffff;
}

.topbar-social a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* ==========================================
   MAIN NAVIGATION
   ========================================== */
.custom-navbar {
    background: #ffffff;
    padding: 0;
    position: relative;
}

.custom-navbar .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    min-height: 85px;
    flex-wrap: nowrap !important;
}

/* Ensure proper layout on desktop */
@media (min-width: 992px) {
    .custom-navbar .container {
        flex-direction: row !important;
    }
}

/* Logo Styles */
.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: #2d3436;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-brand img {
    max-height: 70px;
    width: auto;
    object-fit: contain;
    max-width: 280px;
}

.navbar-brand .site-title {
    font-size: 24px;
    font-weight: 700;
    color: #2d3436;
    text-decoration: none;
}

/* Navigation Menu */
.navbar-menu {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex-direction: row !important;
}

.navbar-nav {
    display: flex !important;
    flex-direction: row !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0;
}

.navbar-nav > li {
    position: relative;
    display: inline-block !important;
}

.navbar-nav > li > a {
    display: flex;
    align-items: center;
    padding: 28px 20px;
    color: #2d3436;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    text-transform: capitalize;
    white-space: nowrap;
}

.navbar-nav > li > a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(135deg, #8cc63f 0%, #764ba2 100%);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.navbar-nav > li > a:hover,
.navbar-nav > li.current-menu-item > a,
.navbar-nav > li.current_page_item > a {
    color: #8cc63f;
}

.navbar-nav > li > a:hover::before,
.navbar-nav > li.current-menu-item > a::before,
.navbar-nav > li.current_page_item > a::before {
    width: 80%;
}

/* Dropdown Indicator - Desktop only */
@media (min-width: 992px) {
    .navbar-nav li.menu-item-has-children > a::after {
        content: '\f107';
        font-family: 'FontAwesome';
        margin-left: 6px;
        font-size: 12px;
        transition: transform 0.3s ease;
    }

    .navbar-nav li.menu-item-has-children:hover > a::after {
        transform: rotate(180deg);
    }
    
    /* Hide mobile submenu arrow on desktop */
    .submenu-toggle-arrow {
        display: none !important;
    }
}

/* Dropdown Menu */
.navbar-nav .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    background: #ffffff;
    list-style: none;
    margin: 0;
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    z-index: 1000;
}

/* Custom Scrollbar for Submenu */
.navbar-nav .sub-menu::-webkit-scrollbar {
    width: 6px;
}

.navbar-nav .sub-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.navbar-nav .sub-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8cc63f 0%, #764ba2 100%);
    border-radius: 3px;
}

.navbar-nav .sub-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7ab535 0%, #653a8b 100%);
}

.navbar-nav li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-nav .sub-menu li {
    position: relative;
}

.navbar-nav .sub-menu li a {
    display: block;
    padding: 12px 24px;
    color: #2d3436;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.navbar-nav .sub-menu li a:hover,
.navbar-nav .sub-menu li.current-menu-item a {
    background: linear-gradient(90deg, rgba(140, 198, 63, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
    border-left-color: #8cc63f;
    color: #8cc63f;
    padding-left: 28px;
}

/* Nested Dropdown */
.navbar-nav .sub-menu .sub-menu {
    top: 0;
    left: 100%;
    margin-left: 0;
}

/* CTA Button */
.navbar-cta {
    margin-left: 20px;
    display: flex !important;
    align-items: center;
}

.navbar-cta .btn-primary {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #8cc63f;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(140, 198, 63, 0.3);
    white-space: nowrap;
}

.navbar-cta .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(140, 198, 63, 0.4);
}

/* Mobile Menu Toggle */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 10001;
    position: relative;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: rgba(72, 252, 123, 0.1);
}

.navbar-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background:#8cc63f;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ==========================================
   RESPONSIVE STYLES
   ========================================== */

/* Small Laptops (14-inch screens and below) */
@media (max-width: 1400px) {
    .custom-navbar .container,
    .custom-topbar .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .navbar-brand img {
        max-height: 55px;
        max-width: 220px;
    }
    
    .navbar-nav > li > a {
        padding: 28px 12px;
        font-size: 14px;
    }
    
    .navbar-cta {
        margin-left: 10px;
    }
    
    .navbar-cta .btn-primary {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Extra Small Laptops (very tight screens) */
@media (max-width: 1200px) {
    .navbar-brand img {
        max-height: 50px;
        max-width: 200px;
    }
    
    .navbar-nav > li > a {
        padding: 28px 10px;
        font-size: 13px;
    }
    
    .navbar-menu {
        gap: 5px;
    }
    
    .navbar-cta {
        margin-left: 8px;
    }
    
    .navbar-cta .btn-primary {
        padding: 8px 16px;
        font-size: 12px;
        gap: 5px;
    }
}

/* Tablet */
@media (max-width: 991px) {
    .custom-topbar {
        display: none;
    }
    
    .custom-navbar .container {
        min-height: 70px;
    }
    
    .navbar-toggle {
        display: flex;
        touch-action: manipulation;
    }
    
    .navbar-menu {
        position: fixed !important;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 80px 0 30px;
        overflow-y: auto;
        transition: right 0.4s ease;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 10000;
        touch-action: pan-y;
    }
    
    .navbar-menu.active {
        right: 0 !important;
    }
    
    .navbar-nav {
        flex-direction: column !important;
        width: 100%;
        gap: 0 !important;
    }
    
    .navbar-nav > li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        display: block !important;
    }
    
    .navbar-nav > li > a {
        padding: 15px 25px;
        width: 100%;
        pointer-events: auto !important;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
        display: flex;
        align-items: center;
        text-decoration: none;
    }
    
    .navbar-nav > li:not(.menu-item-has-children) > a {
        /* Ensure regular links are always clickable */
        pointer-events: auto !important;
    }
    
    .navbar-nav > li > a::before {
        display: none;
    }
    
    .navbar-nav li.menu-item-has-children > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .navbar-nav li.menu-item-has-children > a::after {
        margin-left: auto;
    }
    
    /* Mobile submenu arrow */
    .submenu-toggle-arrow {
        margin-left: auto;
        padding: 5px 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.3s ease;
    }
    
    .menu-item-has-children.active .submenu-toggle-arrow {
        transform: rotate(180deg);
    }
    
    .submenu-toggle-arrow i {
        font-size: 12px;
        pointer-events: none;
    }
    
    .navbar-nav .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        background: #f8f9fa;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        padding: 0;
    }
    
    .navbar-nav li.menu-item-has-children.active > .sub-menu {
        max-height: 500px;
        padding: 8px 0;
    }
    
    .navbar-nav .sub-menu li a {
        padding: 12px 25px 12px 40px;
        pointer-events: auto !important;
        cursor: pointer;
        touch-action: manipulation;
    }
    
    .navbar-nav .sub-menu .sub-menu {
        background: #eef0f2;
    }
    
    .navbar-nav .sub-menu .sub-menu li a {
        padding-left: 55px;
        pointer-events: auto !important;
    }
    
    .navbar-cta {
        margin: 20px 25px 0;
        width: calc(100% - 50px);
    }
    
    .navbar-cta .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile Menu Overlay */
    /* .navbar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 9999;
        pointer-events: none;
        touch-action: manipulation;
    } */
    
    .navbar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .navbar-brand img {
        max-height: 55px;
    }
    
    .navbar-menu {
        width: 280px;
    }
    
    .custom-navbar .container {
        min-height: 60px;
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.navbar-search {
    margin-left: 15px;
}

.navbar-search button {
    background: transparent;
    border: none;
    color: #2d3436;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

.navbar-search button:hover {
    color: #8cc63f;
    transform: scale(1.1);
}

/* Accessibility */
.navbar-nav a:focus,
.navbar-toggle:focus,
.navbar-cta .btn-primary:focus {
    outline: 2px solid #8cc63f;
    outline-offset: 2px;
}

/* Animation for dropdown items */
.navbar-nav .sub-menu li {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.navbar-nav li:hover > .sub-menu li:nth-child(1) {
    animation-delay: 0.05s;
}

.navbar-nav li:hover > .sub-menu li:nth-child(2) {
    animation-delay: 0.1s;
}

.navbar-nav li:hover > .sub-menu li:nth-child(3) {
    animation-delay: 0.15s;
}

.navbar-nav li:hover > .sub-menu li:nth-child(4) {
    animation-delay: 0.2s;
}

.navbar-nav li:hover > .sub-menu li:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar for mobile menu */
.navbar-menu::-webkit-scrollbar {
    width: 6px;
}

.navbar-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.navbar-menu::-webkit-scrollbar-thumb {
    background: #8cc63f;
    border-radius: 10px;
}

.navbar-menu::-webkit-scrollbar-thumb:hover {
    background: #7ab535;
}
