/* navbar.css - Premium Glassmorphism Navbar */

:root {
    --nav-bg: rgba(255, 255, 255, 0.85);
    --nav-backdrop: 12px;
    --nav-border: 1px solid rgba(255, 255, 255, 0.3);
    --nav-text: #1a202c;
    --nav-hover: #3182ce;
    --nav-active-bg: rgba(49, 130, 206, 0.1);
}

.premium-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Removed background and backdrop-filter from here so it doesn't trap fixed children */
    border-bottom: var(--nav-border);
    padding: 0 1.5rem;
    height: 70px;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    /* Fixed height to ensure consistency */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.navbar-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(var(--nav-backdrop));
    -webkit-backdrop-filter: blur(var(--nav-backdrop));
    z-index: -1;
    /* Behind the content */
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.navbar-brand img {
    height: 36px;
    width: auto;
}

.navbar-links {
    display: flex;
    gap: 30px;
    /* Increased gap for better organization */
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    height: 100%;
    flex: 1;
    /* Takes available space */
    justify-content: center;
    /* Centers the links */
}

.nav-link {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    /* Larger touch target */
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    /* For active indicator */
}

.nav-link:hover,
.nav-link.active,
.nav-item-dropdown:hover .nav-link {
    /* Keep highlighted when dropdown is open */
    color: var(--nav-hover);
    background: var(--nav-active-bg);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -18px;
    /* Places it at the bottom of the bar */
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--nav-hover);
    border-radius: 3px 3px 0 0;
}

/* Dropdown */
.nav-item-dropdown {
    position: relative;
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
}

/* 
   Solid Bridge Technique:
   Instead of a separate pseudo-element, we pad the menu's top 
   so the mouse is technically "inside" the menu earlier.
*/
.dropdown-menu {
    position: absolute;
    top: 90%;
    /* Slight overlap to prevent gap */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    /* Centered dropdown */
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    /* Premium Shadow */
    border-radius: 12px;
    /* Softer corners */
    min-width: 220px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    /* Apple-like easing */
    list-style: none;
    display: flex;
    flex-direction: column;
    z-index: 1100;

    /* The Magic Bridge */
    padding-top: 15px;
    clip-path: inset(-20px -20px -20px -20px);
    /* Allow shadow/padding to be visible */
    margin-top: 0;
}

.dropdown-menu::before {
    /* Visual separation line inside the menu, below the bridge padding */
    content: '';
    display: block;
    height: 10px;
    width: 100%;
}

.nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    top: 90%;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-weight: 500;
    border-left: 2px solid transparent;
}

.dropdown-item:hover {
    background: #f7fafc;
    color: var(--nav-hover);
    padding-left: 24px;
    /* Subtle slide effect */
    border-left-color: var(--nav-hover);
}

/* Right Side Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 200px;
    /* Balances the layout */
    justify-content: flex-end;
    flex-shrink: 0;
}

.btn-logout {
    background: none;
    border: 1px solid #e2e8f0;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e53e3e;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fff5f5;
    border-color: #feb2b2;
}

.user-greeting {
    font-size: 0.9rem;
    color: #718096;
    margin-right: 10px;
    display: none;
    /* Hidden on small screens initially */
}

@media (min-width: 768px) {
    .user-greeting {
        display: inline;
    }
}

/* Mobile Toggle */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--nav-text);
    cursor: pointer;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .premium-navbar {
        padding: 0 0.5rem;
        display: grid;
        grid-template-columns: auto 1fr auto auto;
        grid-template-rows: 70px auto;
        height: auto;
        min-height: 70px;
        position: relative;
        border-bottom: none;
        align-items: center;
    }

    .navbar-backdrop {
        grid-column: 1 / -1;
        grid-row: 1;
        height: 100%;
        width: 100%;
        border-bottom: var(--nav-border);
        z-index: -1;
    }

    .navbar-actions {
        min-width: unset;
        gap: 5px;
        justify-content: flex-end;
        grid-column: 3;
        grid-row: 1;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .user-greeting {
        display: none !important;
    }

    .navbar-brand {
        gap: 6px;
        grid-column: 1;
        grid-row: 1;
        margin-right: 10px;
    }

    .navbar-brand span {
        font-size: 1.1rem;
    }

    .navbar-toggle {
        display: block;
        margin-left: 5px;
        font-size: 1.3rem;
        grid-column: 4;
        grid-row: 1;
    }

    .navbar-links {
        grid-column: 1 / -1;
        grid-row: 2;
        position: relative;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 20px 0;
        gap: 0;
        box-shadow: none;
        display: none;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        z-index: 100;
        overflow-y: visible;
        overflow-x: hidden;
    }

    .navbar-links.open {
        display: flex;
        /* Show when toggled */
    }

    .nav-link {
        width: 100%;
        padding: 15px 10px;
        justify-content: center;
        /* Center text/icon */
        text-align: center;
    }

    .nav-item-dropdown {
        width: 100%;
        height: auto;
        flex-direction: column;
        align-items: center;
        /* Center dropdown container */
    }

    .nav-item-dropdown .nav-link {
        width: 100%;
        justify-content: center;
        /* Center dropdown toggle */
    }

    /* Submenu Centering */
    .dropdown-menu {
        position: static !important;
        /* Force static flow */
        box-shadow: none !important;
        padding: 10px 0 !important;
        border: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        /* KILL desktop transforms */
        clip-path: none !important;
        margin: 0 !important;
        left: auto !important;
        /* Reset left positioning */
        top: auto !important;
        background: rgba(0, 0, 0, 0.02) !important;
        width: 100% !important;
        /* Force full width */
        min-width: unset !important;
        display: none;
        transition: none !important;
        /* KILL animations */
        text-align: center !important;
        box-sizing: border-box !important;
    }

    /* Hide the bridge pseudo-element */
    .dropdown-menu::before {
        display: none;
    }

    .nav-item-dropdown.active-mobile .dropdown-menu {
        display: flex !important;
        /* Force flex immediately */
        flex-direction: column;
        align-items: center;
        /* Center items horizontally */
        width: 100%;
        /* Ensure full width */
    }

    .dropdown-item {
        padding: 12px 10px;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        justify-content: center;
        display: flex;
        /* Ensure flex behavior for centering content */
        margin: 0;
        /* Remove potential margins */
    }
}