/* Ensure these variables exist */
:root {
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 20px;
    --nav-text: #1a202c;
    --nav-hover: #7928ca;
    --nav-active-bg: rgba(121, 40, 202, 0.08);
    --nav-radius: 24px;
    --nav-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

/* FLOATING NAVBAR CONTAINER */
.navbar-floating {
    top: 10px; /* UPDATED: 10px above content as requested */
    left: 50%;
    transform: translateX(-50%);
    width: 60%; /* Updated to user preference */
    max-width: 1200px;
    border-radius: var(--nav-radius);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--nav-shadow);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding: 0.8rem 1rem;
    z-index: 1030;
}

/* Scrolled State: Compacts slightly and docks higher */
.navbar-floating.scrolled {
    top: 0px; /* Docks to top when scrolling */
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    width: 65%; /* Expands slightly but keeps floating feel */
    max-width: 1280px;
    border-radius: 0 0 var(--nav-radius) var(--nav-radius); /* Optional: round only bottom corners when docked */
}

/* Branding */
.navbar-brand {
    color: var(--nav-text);
    transition: transform 0.3s;
}
.navbar-brand:hover {
    transform: scale(1.02);
}
.brand-text {
    font-weight: 800;
    color: var(--nav-text);
    font-size: 1.1rem;
}

/* Animated Entrance */
.animate-entrance {
    opacity: 0;
    animation: slideDownFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Navigation Links with Hover Effect */
.header-nav-link {
    color: #64748b;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 1.2rem !important;
    position: relative;
    transition: color 0.3s ease;
}

.link-text {
    position: relative;
    z-index: 1;
}

/* Underline/Background Hover Animation */
.header-nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--nav-active-bg);
    border-radius: 50px;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.header-nav-link:hover, .header-nav-link.active {
    color: var(--nav-hover) !important;
}

.header-nav-link:hover::before, .header-nav-link.active::before {
    transform: scale(1);
    opacity: 1;
}

/* Dropdown Animation */
.dropdown-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.05);
    transform-origin: top center;
    animation: dropdownScale 0.2s ease forwards;
    display: none; /* Explicitly hidden to allow animation on toggle */
}
.dropdown-menu.show {
    display: block;
}
@keyframes dropdownScale {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
    border-radius: 8px;
}
.dropdown-item:hover {
    background: var(--nav-active-bg);
    color: var(--nav-hover);
    transform: translateX(4px);
}

/* Theme Toggle with Rotation */
.theme-toggle-btn {
    color: var(--nav-text);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-toggle-btn:hover {
    transform: rotate(180deg);
    color: var(--nav-hover);
}

/* CTA Button Pulse */
.btn-cta {
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Hamburger Animation */
.navbar-toggler:focus { box-shadow: none; }
.hamburger-icon { width: 24px; height: 18px; position: relative; }
.hamburger-icon span {
    display: block; position: absolute; height: 2px; width: 100%;
    background: var(--nav-text); border-radius: 2px;
    transition: 0.25s ease-in-out;
}
.hamburger-icon span:nth-child(1) { top: 0px; }
.hamburger-icon span:nth-child(2) { top: 8px; }
.hamburger-icon span:nth-child(3) { top: 16px; }

.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(1) { top: 8px; transform: rotate(135deg); }
.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(2) { opacity: 0; left: -20px; }
.navbar-toggler[aria-expanded="true"] .hamburger-icon span:nth-child(3) { top: 8px; transform: rotate(-135deg); }

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 100px; /* Below the floating header */
    left: 50%;
    transform: translateX(-50%);
    background: #1a202c;
    color: #fff;
    padding: 12px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 2000;
    font-weight: 600;
    animation: toastPopup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes toastPopup {
    from { opacity: 0; transform: translate(-50%, 20px) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* --- DARK MODE OVERRIDES --- */
body.dark-mode {
    --glass-bg: rgba(20, 20, 20, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --nav-text: #ffffff;
    --nav-active-bg: rgba(255, 255, 255, 0.1);
    --nav-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
body.dark-mode .navbar-floating.scrolled {
    background: rgba(20, 20, 20, 0.9);
}
body.dark-mode .logo-icon-box {
    background-color: #ffffff !important;
    color: #000000 !important;
}
body.dark-mode .dropdown-menu {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255,255,255,0.1);
}
body.dark-mode .dropdown-item { color: #cbd5e1; }
body.dark-mode .dropdown-item:hover { color: #fff; }

body.dark-mode .btn-dark {
    background-color: #ffffff;
    color: #000000;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
    .navbar-floating {
        width: 93%;
        border-radius: 20px;
        padding: 0.8rem;
    }
    .navbar-floating.scrolled {
    width: 93%; 
}
    .collapse.show {
        background: transparent;
        margin-top: 1rem;
        max-height: 80vh;
        overflow-y: auto;
    }
    .header-nav-link::before {
        display: none; /* No hover bg on mobile, simpler interaction */
    }
    .header-nav-link {
        padding: 10px 0 !important;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    body.dark-mode .header-nav-link {
        border-bottom-color: rgba(255,255,255,0.05);
    }
}