nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(250, 248, 245, 0.95) 100%
    );
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    z-index: 1000;
    padding: 1.5rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(117, 59, 125, 0.1) inset,
        0 2px 20px rgba(117, 59, 125, 0.15);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 2px solid transparent;
    overflow: visible;
}

nav::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(117, 59, 125, 0.1),
        transparent
    );
    animation: navShimmer 8s ease-in-out infinite;
    z-index: -1;
}

@keyframes navShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

nav::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary),
        var(--secondary),
        var(--primary),
        transparent
    );
    background-size: 200% 100%;
    animation: navBorderFlow 4s linear infinite;
    opacity: 0.6;
}

@keyframes navBorderFlow {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

nav.scrolled {
    padding: 1rem 0;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(117, 59, 125, 0.15) inset,
        0 4px 30px rgba(117, 59, 125, 0.2);
    border-bottom: 2px solid rgba(117, 59, 125, 0.2);
}

.nav-container {
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0 3.5rem;
    position: relative;
    z-index: 1;
    gap: 2rem;
}

.nav-container > .logo {
    flex-shrink: 0;
}

.nav-container > .nav-links {
    justify-self: center;
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
    flex-wrap: nowrap;
    flex-shrink: 0;
    justify-self: end;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.logo img {
    height: 60px;
    width: auto;
    object-fit: contain;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 8px rgba(117, 59, 125, 0.3));
}

.logo:hover img {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 15px rgba(117, 59, 125, 0.5));
}

.doctor-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.3rem;
    letter-spacing: 1px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover .doctor-name {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    justify-content: center;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0;
}

.language-switcher .lang-link {
    text-decoration: none;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: auto;
    white-space: nowrap;
}

.language-switcher .lang-link:hover {
    color: var(--primary);
    background: rgba(117, 59, 125, 0.1);
    transform: translateY(-2px);
}

.language-switcher .lang-link.active {
    color: var(--primary);
    background: linear-gradient(
        135deg,
        rgba(117, 59, 125, 0.2),
        rgba(117, 59, 125, 0.1)
    );
    font-weight: 700;
}

.language-switcher .lang-separator {
    color: var(--secondary);
    opacity: 0.5;
}

.menu-toggle {
    display: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--secondary);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0.7rem 0.9rem;
    border-radius: 25px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
}

.nav-links a::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--secondary),
        var(--primary)
    );
    background-size: 200% 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
    animation: underlineFlow 3s linear infinite;
    opacity: 0;
}

.nav-links a:hover::before {
    width: 80%;
    opacity: 1;
}

@keyframes underlineFlow {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.nav-links a::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle,
        rgba(117, 59, 125, 0.15) 0%,
        transparent 70%
    );
    border-radius: 25px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.nav-links a:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

.nav-links a:hover {
    color: var(--primary);
    transform: translateY(-4px);
    text-shadow: 0 4px 15px rgba(117, 59, 125, 0.4);
}

.nav-links a:active {
    transform: translateY(-2px) scale(0.98);
}

/* Active nav link styles */
.nav-links a.active {
    color: var(--primary);
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(117, 59, 125, 0.5);
}

.nav-links a.active::before {
    width: 90%;
    opacity: 1;
    animation: underlineFlow 2s linear infinite;
}

.nav-links a.active::after {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.nav-links li.active a {
    color: var(--primary);
    position: relative;
}

/* Mobile Menu Button */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(117, 59, 125, 0.4);
    position: relative;
    overflow: hidden;
}

.menu-toggle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.menu-toggle:hover::before {
    width: 200px;
    height: 200px;
}

.menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(117, 59, 125, 0.6);
}

.menu-toggle span {
    width: 28px;
    height: 3px;
    background: var(--white);
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

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

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

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

.nav-links li {
    position: relative;
}

/* Sparkle after active nav link */
.nav-links li::after {
    content: "✨";
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    opacity: 0;
    animation: sparkle 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.nav-links li.active::after,
.nav-links li:hover::after {
    opacity: 1;
}

@keyframes sparkle {
    0%,
    100% {
        opacity: 0.9;
        transform: translateY(-50%) scale(0.95) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.05) rotate(180deg);
    }
}
/* Responsive Navigation Styles */
@media (max-width: 1024px) {
    /* Shrink logo and menu icon on tablets */
    .nav-container {
        padding: 0 2rem !important;
        position: relative;
        z-index: auto;
        overflow: visible !important;
    }

    .logo {
        font-size: 2rem !important;
        letter-spacing: 3px !important;
    }

    .menu-toggle {
        padding: 10px 12px !important;
    }

    .menu-toggle span {
        width: 24px !important;
        height: 2.5px !important;
    }

    /* Remove any constraints from nav and containers */
    nav {
        overflow: visible !important;
        clip-path: none !important;
    }

    .nav-container {
        overflow: visible !important;
        clip-path: none !important;
    }

    /* Ensure nav-links breaks out of any container and covers full viewport */
    .nav-links {
        position: fixed !important;
        margin: 0 !important;
        transform: none !important;
        clip-path: none !important;
        contain: none !important;
    }

    nav {
        padding: 1rem 0;
    }

    nav.scrolled {
        padding: 0.8rem 0;
    }

    /* Mobile menu overlay backdrop - hidden */
    .mobile-menu-overlay {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .mobile-menu-overlay.active {
        display: none !important;
        opacity: 0 !important;
    }

    .nav-links {
        display: flex !important;
        position: fixed !important;
        top: 1rem !important;
        right: -100% !important;
        bottom: 1rem !important;
        width: calc(85% - 2rem) !important;
        max-width: 380px !important;
        height: calc(100vh - 2rem) !important;
        height: calc(100dvh - 2rem) !important;
        min-height: calc(100vh - 2rem) !important;
        min-height: calc(100dvh - 2rem) !important;
        background: linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(250, 248, 245, 0.95) 100%
        ) !important;
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 5.5rem 1.5rem 2rem 1.5rem !important;
        gap: 2rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(117, 59, 125, 0.2) inset;
        z-index: 9999 !important;
        overflow-y: auto;
        overflow-x: hidden;
        visibility: visible !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 20px 0 0 20px;
    }

    .nav-links.active {
        right: 1rem !important;
    }

    /* Logo in mobile menu - positioned below close icon */
    .nav-links::before {
        content: "";
        display: block;
        position: absolute;
        top: 4.5rem;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        max-width: 200px;
        height: 50px;
        background-image: url("../assets/Logo.png");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        padding-bottom: 1.5rem;
        border-bottom: 2px solid rgba(117, 59, 125, 0.3);
        z-index: 1;
    }

    @keyframes logoGradient {
        0%,
        100% {
            background-position: 0% 50%;
        }
        50% {
            background-position: 100% 50%;
        }
    }

    /* Menu items start after logo - push first item below logo divider */
    .nav-links li:first-of-type {
        margin-top: 5.5rem !important;
    }

    /* Ensure body and html don't constrain the menu */
    body.menu-open {
        overflow: hidden !important;
        height: 100vh;
        height: 100dvh;
        position: fixed;
        width: 100%;
    }

    html.menu-open {
        overflow: hidden !important;
        height: 100vh;
        height: 100dvh;
    }

    .nav-links li {
        width: 100%;
        display: flex;
        justify-content: center;
        position: relative;
    }

    .nav-links a {
        font-size: 1.3rem;
        padding: 1.2rem 2rem;
        width: 80%;
        max-width: 300px;
        text-align: center;
        display: block;
    }

    .nav-links li::after {
        display: block !important;
        content: "✨";
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.2rem;
        opacity: 0;
        animation: sparkle 3s ease-in-out infinite;
        pointer-events: none;
        z-index: 1;
        transition: opacity 0.3s ease;
    }

    .nav-links li.active::after,
    .nav-links li:hover::after {
        opacity: 1;
    }

    .language-switcher {
        order: -1;
        margin-left: 0;
        margin-right: auto;
        padding: 0.5rem 0;
    }

    .language-switcher .lang-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .menu-toggle {
        display: flex !important;
        z-index: 10001 !important;
        position: relative;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 10px 12px !important;
    }

    .menu-toggle span {
        width: 24px !important;
        height: 2.5px !important;
    }

    .logo img {
        height: 45px !important;
    }

    .doctor-name {
        font-size: 0.75rem !important;
    }

    /* When menu is open, nav should be below menu but toggle button stays visible */
    nav {
        z-index: 9997;
    }

    nav.scrolled {
        z-index: 9997;
    }

    /* Ensure nav-container and toggle button stay above menu */
    .nav-container {
        z-index: 10000 !important;
        position: relative;
    }

    .nav-container::before {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Further shrink logo and menu icon on smaller tablets/phones */
    .logo img {
        height: 40px !important;
    }

    .doctor-name {
        font-size: 0.7rem !important;
    }

    .nav-container {
        padding: 0 1.25rem !important;
    }

    .language-switcher {
        margin-left: 0;
        margin-right: 1rem;
        order: 0;
    }

    .menu-toggle {
        padding: 9px 11px !important;
    }

    .menu-toggle span {
        width: 22px !important;
        height: 2.5px !important;
    }
}

@media (max-width: 480px) {
    /* Smallest screens - maximum shrinking */
    .logo img {
        height: 35px !important;
    }

    .doctor-name {
        font-size: 0.65rem !important;
    }

    .nav-container {
        padding: 0 1rem !important;
    }

    .menu-toggle {
        padding: 8px 10px !important;
    }

    .menu-toggle span {
        width: 20px !important;
        height: 2px !important;
    }
}
