/* ========================================
   MODERN NAVIGATION BAR STYLES
   eKvietimas - Clean & Professional Design
   ======================================== */

/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
}

:root {
    /* Color Variables - Glass-morphism Design */
    --nav-primary: #a8b5f5;
    --nav-primary-dark: #8e9de8;
    --nav-secondary: #c0b5f0;
    --nav-accent: #8ecef5;
    --nav-text: #ffffff;
    --nav-text-muted: rgba(255, 255, 255, 0.95);
    --nav-hover-bg: rgba(255, 255, 255, 0.2);
    --nav-active-bg: rgba(255, 255, 255, 0.3);
    --nav-shadow: rgba(0, 0, 0, 0.08);
    --nav-mobile-bg: #5c659d;
    --nav-mobile-overlay: rgba(0, 0, 0, 0.4);
    --nav-glass-bg: rgba(255, 255, 255, 0.1);
    --nav-glass-bg-scrolled: rgba(168, 181, 245, 0.95);
    --nav-border: rgba(255, 255, 255, 0.25);
    --nav-border-scrolled: rgba(255, 255, 255, 0.4);

    /* Spacing Variables */
    --nav-height: 80px;
    --nav-height-scrolled: 70px;
    --nav-padding-x: 40px;
    --nav-item-gap: 8px;
    /* Animation Variables */
    --nav-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-hover-lift: translateY(-2px);
}

/* Body Padding */
body {
    padding-top: var(--nav-height);
    transition: padding-top 0.3s ease;
}

body.nav-scrolled {
    padding-top: var(--nav-height-scrolled);
}

/* ===== HEADER CONTAINER ===== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 9999;
    background: transparent;
    transition: var(--nav-transition);
    padding: 10px var(--nav-padding-x);
}

/* Header when scrolled - full width */
#header.header-scrolled {
    height: var(--nav-height-scrolled);
    padding: 0;
}

/* Container */
#header .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    height: 100%;
    background: var(--nav-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--nav-border);
    border-radius: 50px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: var(--nav-transition);
}

/* Container when scrolled - full width, no border radius */
    #header.header-scrolled .container-fluid {
        max-width: 100%;
        background: linear-gradient(135deg, #667ce7 0%, #715bb8 100%);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border: none;
        border-radius: 0;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 20px;
    padding: 0 30px;
}

/* ===== LOGO ===== */
.logo {
    flex-shrink: 0;
    flex: 0 0 auto;  /* Fixed width, don't grow or shrink */
    z-index: 10001;
    text-transform: uppercase;
}

.logo a {
    display: inline-flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--nav-text);
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.5px;
    transition: var(--nav-transition);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.logo a span {
    color: #ffd580;
    font-size: 28px;
    margin-left: 2px;
}

.logo a:hover {
    transform: scale(1.05);
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

/* ===== NAVIGATION ===== */
#newnav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;  /* Grow to fill space */
    justify-content: space-between;  /* Space between main and auth */
    height: 100%;
    padding: 0;
    gap: 20px;
}

#newnav .navbar-ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    padding-top: 20px;
    gap: var(--nav-item-gap);
    align-items: center;
    height: 100%;
    flex-wrap: nowrap;
}

/* Main navigation items (centered in available space) */
#newnav .navbar-ul.main-nav {
    justify-content: center;
    flex: 1 1 auto;  /* Grow to fill space and center */
}

/* Auth buttons container (right aligned) */
#newnav .navbar-ul.auth-nav {
    justify-content: flex-end;
    flex: 0 0 auto;  /* Don't grow, fixed size */
    padding-left: 20px;
}

#newnav .navbar-ul .nav-link {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

#newnav .navbar-ul .nav-link a {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    color: var(--nav-text-muted);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 20px;
    transition: var(--nav-transition);
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
#newnav .navbar-ul .nav-link a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#newnav .navbar-ul .nav-link a:hover::before {
    left: 100%;
}

#newnav .navbar-ul .nav-link a:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-text);
    transform: var(--nav-hover-lift);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Active Link */
#newnav .navbar-ul .nav-link a.active {
    background: var(--nav-active-bg);
    color: var(--nav-text);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Login/Register/Logout buttons in navbar - desktop style */
#newnav .navbar-ul .nav-link a.get-started-btn {
    /*background: white;*/
    color: var(--nav-text-muted) !important;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px 20px;
}

#newnav .navbar-ul .nav-link a.get-started-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--nav-primary-dark) !important;
    transform: var(--nav-hover-lift);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Logout button variant */
#newnav .navbar-ul .nav-link a.get-started-btn#logout {
    background: rgba(255, 182, 193, 0.85);
    color: white !important;
    border-color: rgba(255, 182, 193, 0.85);
}

#newnav .navbar-ul .nav-link a.get-started-btn#logout:hover {
    background: rgba(255, 182, 193, 1);
    border-color: rgba(255, 182, 193, 1);
    color: white !important;
}

/* ===== MOBILE NAVIGATION TOGGLE ===== */
.mobile-nav-toggle {
    display: none;
    font-size: 28px;
    color: var(--nav-text);
    cursor: pointer;
    transition: var(--nav-transition);
    padding: 8px;
    border-radius: 8px;
    background: transparent;
    border: none;
    z-index: 10001;
}

.mobile-nav-toggle:hover {
    background: var(--nav-hover-bg);
    transform: scale(1.1);
}

.mobile-nav-toggle:active {
    transform: scale(0.95);
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 1200px) {
    :root {
        --nav-padding-x: 20px;
        --nav-item-gap: 5px;
    }

    #newnav .navbar-ul .nav-link a {
        padding: 8px 16px;
        font-size: 14px;
    }

    .logo a {
        font-size: 22px;
    }

    .logo a span {
        font-size: 26px;
    }

    #newnav .navbar-ul .nav-link a.get-started-btn {
        padding: 8px 18px;
        font-size: 13px;
    }

    .header-container {
        padding: 0 25px;
    }
}

/* ===== RESPONSIVE - SMALL DESKTOP / LARGE TABLET ===== */
@media (max-width: 1100px) {
    :root {
        --nav-padding-x: 15px;
        --nav-item-gap: 4px;
    }

    #newnav .navbar-ul .nav-link a {
        padding: 8px 14px;
        font-size: 13px;
    }

    .logo a {
        font-size: 20px;
    }

    .logo a span {
        font-size: 24px;
    }

    #newnav .navbar-ul .nav-link a.get-started-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .header-container {
        padding: 0 20px;
    }
}

/* ===== RESPONSIVE - COMPACT DESKTOP ===== */
@media (max-width: 1000px) {
    :root {
        --nav-padding-x: 15px;
        --nav-item-gap: 3px;
        --nav-height: 75px;
    }

    #header .container-fluid {
        border-radius: 40px;
    }

    #newnav .navbar-ul .nav-link a {
        padding: 7px 12px;
        font-size: 13px;
    }

    .logo a {
        font-size: 19px;
    }

    .logo a span {
        font-size: 23px;
    }

    #newnav .navbar-ul .nav-link a.get-started-btn {
        padding: 7px 14px;
        font-size: 12px;
    }

    .header-container {
        padding: 0 18px;
    }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 991px) {
    :root {
        --nav-height: 70px;
        --nav-height-scrolled: 65px;
        --nav-padding-x: 15px;
    }

    #header {
        padding: 10px var(--nav-padding-x);
    }

    #header.header-scrolled {
        padding: 0px 0px 0px 0px var(--nav-padding-x);
    }

    #header .container-fluid {
        border-radius: 0px;
    }

    body {
        padding-top: var(--nav-height);
    }

    body.nav-scrolled {
        padding-top: var(--nav-height-scrolled);
    }

    .logo a {
        font-size: 20px;
    }

    .logo a span {
        font-size: 24px;
    }

    .header-container {
        padding: 0 20px;
    }

    /* Show Mobile Toggle */
    .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* MOBILE NAVIGATION - PROPER ANIMATION */
    #newnav {
        position: fixed;
        top: calc(var(--nav-height) + 10px);
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
        background: var(--nav-mobile-bg) !important;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 0 !important;
        margin: 0;
        z-index: 9998;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        
        /* Start collapsed */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        
        /* Smooth animation */
        transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.4s ease,
                    visibility 0s linear 0.4s,
                    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* EXPANDED STATE */
    #newnav.navbar-mobile {
        display: flex !important;
        max-height: 100vh !important;
        height: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        overflow-y: auto;
        overflow-x: hidden;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
        -webkit-overflow-scrolling: touch;
        
        /* Instant visibility, no delay on open */
        transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.4s ease,
                    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Mobile Navbar Lists - both main-nav and auth-nav */
    #newnav .navbar-ul {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100%;
        align-items: stretch;
        margin: 0;
        padding: 10px;
        list-style: none;
        background: transparent;
        min-height: auto;
    }

    /* No extra margin for auth-nav on mobile */
    #newnav .navbar-ul.auth-nav {
        margin-left: 0;
        padding-left: 10px;
        padding-top: 0;
        border-top: 2px solid rgba(255, 255, 255, 0.15);
    }

    /* Mobile Navbar List */
    #newnav .navbar-ul .nav-link {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        flex-shrink: 0;
        height: auto;
    }

    #newnav .navbar-ul .nav-link:last-child {
        border-bottom: none;
    }

    #newnav .navbar-ul .nav-link a {
        display: flex !important;
        width: 100%;
        padding: 16px 20px !important;
        margin: 0;
        border-radius: 15px !important;
        font-size: 16px !important;
        font-weight: 500;
        align-items: center;
        justify-content: flex-start;
        color: #ffffff !important;
        background: transparent !important;
        text-decoration: none;
        white-space: nowrap;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        transition: all 0.25s ease;
        min-height: 50px;
    }

    #newnav .navbar-ul .nav-link a::before {
        display: none !important;
    }

    #newnav .navbar-ul .nav-link a:hover {
        background: rgba(255, 255, 255, 0.2) !important;
        padding-left: 30px !important;
        color: #ffffff !important;
        transform: none !important;
        box-shadow: none !important;
    }

    #newnav .navbar-ul .nav-link a.active {
        background: rgba(255, 255, 255, 0.25) !important;
        border-left: 4px solid #8ecef5 !important;
        padding-left: 16px !important;
        color: #ffffff !important;
    }

    #newnav .navbar-ul .nav-link a.active:hover {
        padding-left: 26px !important;
    }

    /* Login/Register/Logout buttons on mobile */
    #newnav .navbar-ul .nav-link a.get-started-btn {
        background: rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 15px !important;
        box-shadow: none !important;
        padding: 16px 20px !important;
        font-size: 16px !important;
        font-weight: 600;
        margin: 5px 0 !important;
        border-top: none !important;
        transform: none !important;
        min-height: 50px;
    }

    #newnav .navbar-ul .nav-link a.get-started-btn:hover {
        background: rgba(255, 255, 255, 0.35) !important;
        padding-left: 30px !important;
        color: #ffffff !important;
        transform: none !important;
        box-shadow: none !important;
    }

    /* Logout button variant */
    #newnav .navbar-ul .nav-link a.get-started-btn[href*="Logout"],
    #newnav .navbar-ul .nav-link a#logout {
        background: rgba(255, 182, 193, 0.4) !important;
        color: #ffffff !important;
        border-color: transparent !important;
    }

    #newnav .navbar-ul .nav-link a.get-started-btn[href*="Logout"]:hover,
    #newnav .navbar-ul .nav-link a#logout:hover {
        background: rgba(255, 182, 193, 0.6) !important;
        padding-left: 30px !important;
        color: #ffffff !important;
    }

    /* Mobile Overlay with animation */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9997;
        animation: fadeIn 0.3s ease-in-out forwards;
    }

    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Scrollbar for mobile menu */
    #newnav.navbar-mobile::-webkit-scrollbar {
        width: 6px;
    }

    #newnav.navbar-mobile::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    #newnav.navbar-mobile::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.25);
        border-radius: 3px;
    }

    #newnav.navbar-mobile::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.35);
    }
}

/* ===== RESPONSIVE - SMALL MOBILE ===== */
@media (max-width: 480px) {
    :root {
        --nav-height: 65px;
        --nav-height-scrolled: 60px;
        --nav-padding-x: 12px;
    }

    .logo a {
        font-size: 18px;
    }

    .logo a span {
        font-size: 22px;
    }

    .mobile-nav-toggle {
        font-size: 26px;
        padding: 6px;
    }

    #newnav .navbar-ul .nav-link a {
        padding: 14px 18px !important;
        font-size: 15px !important;
    }

    .header-container {
        padding: 0 15px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== ACCESSIBILITY ===== */
#newnav .navbar-ul .nav-link a:focus,
.get-started-btn:focus,
.mobile-nav-toggle:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

#newnav .navbar-ul .nav-link a:focus:not(:focus-visible),
.get-started-btn:focus:not(:focus-visible),
.mobile-nav-toggle:focus:not(:focus-visible) {
    outline: none;
}

/* ===== SPECIAL PAGES ===== */
/* Hide navbar on kvietimas.aspx page */
body.kvietimas-page #header,
body.kvietimas-page #footer {
    display: none !important;
}

body.kvietimas-page {
    padding-top: 0 !important;
}

/* ===== LANGUAGE DROPDOWN ===== */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    transition: var(--nav-transition);
    border-radius: 8px;
}

.dropdown-toggle:hover {
    background: var(--nav-hover-bg);
    transform: scale(1.1);
}

.dropdown-toggle img {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--nav-transition);
    z-index: 10002;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #2d3748;
    text-decoration: none;
    transition: var(--nav-transition);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.dropdown-item:hover {
    background: #f7fafc;
    color: var(--nav-primary);
}

.dropdown-item.active {
    background: rgba(168, 181, 245, 0.1);
    color: var(--nav-primary);
    font-weight: 600;
}

.dropdown-item img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* ===== PRINT STYLES ===== */
@media print {
    #header {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }
}

/* ===== SCROLLBAR CUSTOMIZATION (Mobile Menu) ===== */
#newnav::-webkit-scrollbar {
    width: 6px;
}

#newnav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#newnav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#newnav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
#header {
    will-change: transform, background;
}

#newnav .navbar-ul .nav-link a {
    will-change: transform, background;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
