/**
 * Modern Navigation System
 * Brand-consistent top navigation with mobile bottom tabs
 * User Dashboard: Top Nav (Desktop) + Bottom Tabs (Mobile)
 * Admin Dashboard: Modern Sidebar
 */

/* ================================
   VARIABLES
   ================================ */
:root {
    --nav-height-desktop: 64px;
    --nav-height-mobile: 70px;
    --nav-brand-purple: #6366F1;
    --nav-purple-dark: #4F46E5;
    --nav-purple-light: #818CF8;
    --nav-purple-bg: #EEF2FF;
    --nav-text-primary: #1F2937;
    --nav-text-muted: #6B7280;
    --nav-bg: #FFFFFF;
    --nav-border: #E5E7EB;
    --nav-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --nav-transition: 200ms ease-in-out;
}

/* ================================
   TOP NAVIGATION - DESKTOP
   ================================ */

.navbar-modern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height-desktop);
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
}

.navbar-modern-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    text-decoration: none;
    color: var(--nav-text-primary);
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.navbar-modern-brand img {
    height: 40px;
    width: auto;
}

.navbar-modern-brand span {
    display: none;
}

@media (min-width: 1200px) {
    .navbar-modern-brand span {
        display: inline;
        font-size: 1rem;
        font-weight: 600;
        color: var(--nav-text-primary);
    }
}

/* Navigation Menu */
.navbar-modern-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 1024px) {
    .navbar-modern-menu {
        display: flex;
    }
}

.navbar-modern-menu li {
    position: relative;
}

.navbar-modern-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: var(--nav-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--nav-transition);
    white-space: nowrap;
}

.navbar-modern-menu a:hover {
    color: var(--nav-brand-purple);
}

.navbar-modern-menu a.active {
    color: var(--nav-brand-purple);
    font-weight: 600;
}

/* Active indicator line */
.navbar-modern-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--nav-brand-purple);
    border-radius: 2px;
}

/* Right side: Actions */
.navbar-modern-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.navbar-modern-actions i {
    color: var(--nav-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color var(--nav-transition);
}

.navbar-modern-actions i:hover {
    color: var(--nav-brand-purple);
}

/* User Avatar Dropdown */
.navbar-modern-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nav-brand-purple), var(--nav-purple-light));
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--nav-transition);
    position: relative;
}

.navbar-modern-avatar:hover {
    transform: scale(1.05);
}

/* Dropdown Menu */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 1rem);
    right: 0;
    background: var(--nav-bg);
    border: 1px solid var(--nav-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    display: none;
    flex-direction: column;
    z-index: 1040;
}

.nav-dropdown.show {
    display: flex;
}

.nav-dropdown a,
.nav-dropdown button {
    padding: 0.75rem 1rem;
    color: var(--nav-text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: background-color var(--nav-transition);
    text-align: left;
    width: 100%;
}

.nav-dropdown a:first-child,
.nav-dropdown button:first-child {
    border-radius: 8px 8px 0 0;
}

.nav-dropdown a:last-child,
.nav-dropdown button:last-child {
    border-radius: 0 0 8px 8px;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover {
    background-color: var(--nav-purple-bg);
    color: var(--nav-brand-purple);
}

.nav-dropdown-divider {
    height: 1px;
    background-color: var(--nav-border);
    margin: 0.5rem 0;
}

.nav-dropdown-logout {
    color: #EF4444;
}

.nav-dropdown-logout:hover {
    background-color: #FEE2E2;
    color: #DC2626;
}

/* ================================
   MAIN CONTENT OFFSET
   ================================ */

.main-content-modern {
    margin-top: var(--nav-height-desktop);
    margin-bottom: 0;
    transition: all var(--nav-transition);
}

@media (max-width: 1023px) {
    .main-content-modern {
        margin-top: 60px;
    }
}

@media (max-width: 767px) {
    .main-content-modern {
        margin-top: 50px;
        margin-bottom: var(--nav-height-mobile);
    }
}

/* ================================
   MOBILE BOTTOM NAVIGATION
   ================================ */

.navbar-bottom-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height-mobile);
    background-color: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1030;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

@media (max-width: 767px) {
    .navbar-bottom-mobile {
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        padding-top: 0.75rem;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--nav-text-muted);
    font-size: 0.625rem;
    font-weight: 600;
    transition: color var(--nav-transition);
    padding: 0.5rem;
    flex: 1;
    text-align: center;
}

.mobile-nav-item i {
    font-size: 1.5rem;
    transition: color var(--nav-transition);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--nav-brand-purple);
}

.mobile-nav-item.active {
    font-weight: 700;
    background-color: var(--nav-purple-bg);
    border-radius: 8px;
}

.mobile-nav-item i.active {
    color: var(--nav-brand-purple);
}

/* ================================
   MOBILE TOP BAR
   ================================ */

.navbar-top-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    z-index: 1029;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 767px) {
    .navbar-top-mobile {
        display: flex;
    }
}

@media (min-width: 768px) {
    .navbar-top-mobile {
        display: none;
    }
}

.mobile-top-left,
.mobile-top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--nav-text-primary);
    padding: 0.5rem;
}

.mobile-hamburger:active {
    color: var(--nav-brand-purple);
}

.mobile-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--nav-text-primary);
    flex: 1;
    text-align: center;
}

.mobile-notif-icon {
    font-size: 1.25rem;
    color: var(--nav-text-muted);
    cursor: pointer;
}

.mobile-notif-icon:active {
    color: var(--nav-brand-purple);
}

/* ================================
   MOBILE MENU OVERLAY
   ================================ */

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1028;
}

@media (max-width: 767px) {
    .mobile-menu-overlay.show {
        display: block;
    }
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    width: 280px;
    height: calc(100vh - 50px - var(--nav-height-mobile));
    background-color: var(--nav-bg);
    border-right: 1px solid var(--nav-border);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1029;
    overflow-y: auto;
}

@media (max-width: 767px) {
    .mobile-menu.show {
        display: flex;
        flex-direction: column;
    }
}

.mobile-menu a,
.mobile-menu button {
    padding: 1rem 1.25rem;
    color: var(--nav-text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color var(--nav-transition);
    border-left: 3px solid transparent;
}

.mobile-menu a:hover,
.mobile-menu button:hover {
    background-color: var(--nav-purple-bg);
    color: var(--nav-brand-purple);
}

.mobile-menu a.active {
    background-color: var(--nav-purple-bg);
    color: var(--nav-brand-purple);
    border-left-color: var(--nav-brand-purple);
    font-weight: 600;
}

.mobile-menu-divider {
    height: 1px;
    background-color: var(--nav-border);
    margin: 0.5rem 0;
}

.mobile-menu-logout {
    color: #EF4444;
    margin-top: auto;
}

.mobile-menu-logout:hover {
    background-color: #FEE2E2;
    color: #DC2626;
}

/* ================================
   RESPONSIVE ADJUSTMENTS
   ================================ */

/* Tablet: Collapse nav menu to dropdown */
@media (max-width: 1023px) {
    .navbar-modern {
        padding: 0 1.5rem;
    }

    .navbar-modern-menu {
        display: none;
    }

    .navbar-modern-menu.show {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
        background-color: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border);
        border-radius: 0;
    }

    .navbar-modern-menu li {
        width: 100%;
    }

    .navbar-modern-menu a {
        padding: 0.75rem 1.5rem;
        border-bottom: 1px solid var(--nav-border);
    }

    .navbar-modern-menu a::after {
        display: none;
    }

    .navbar-modern-menu a.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background-color: var(--nav-brand-purple);
    }
}

/* ================================
   ACCESSIBILITY
   ================================ */

.navbar-modern a:focus,
.navbar-modern button:focus,
.mobile-nav-item:focus,
.mobile-hamburger:focus {
    outline: 2px solid var(--nav-brand-purple);
    outline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
