/**
 * Responsive Navigation System
 * Mobile hamburger menu, sidebar slide-in, and overlay
 */

/* ============================================
   Hamburger Menu Button
   ============================================ */

/* Mobile: Show hamburger menu */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    min-width: 44px; /* Touch target */
    min-height: 44px; /* Touch target */
    align-items: center;
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background: var(--gray-700, #374151);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animated hamburger to X */
.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Desktop (1024px+): Hide hamburger */
@media (min-width: 1024px) {
    .hamburger-menu {
        display: none;
    }
}

/* ============================================
   Sidebar Navigation
   ============================================ */

/* Mobile: Sidebar hidden off-screen by default */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden off-screen */
    width: 280px;
    height: 100vh;
    background: var(--white, #ffffff);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Mobile: Sidebar slides in when active */
.sidebar.active {
    transform: translateX(280px);
}

/* Desktop (1024px+): Sidebar always visible */
@media (min-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: none;
        box-shadow: none;
        border-right: 1px solid var(--gray-200, #e5e7eb);
    }
    
    .sidebar.active {
        transform: none;
    }
}

/* ============================================
   Mobile Overlay
   ============================================ */

/* Overlay appears when sidebar is open on mobile */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Desktop: No overlay needed */
@media (min-width: 1024px) {
    .mobile-overlay {
        display: none;
    }
}

/* ============================================
   Sidebar Content
   ============================================ */

/* Sidebar header */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900, #111827);
    text-decoration: none;
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--primary-color, #6366f1);
}

/* Sidebar navigation */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav a,
.sidebar-nav button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--gray-700, #374151);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9375rem;
    min-height: 44px; /* Touch target */
}

.sidebar-nav a:hover,
.sidebar-nav button:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--primary-color, #6366f1);
}

.sidebar-nav a.active,
.sidebar-nav button.active {
    background: var(--primary-50, #eef2ff);
    color: var(--primary-color, #6366f1);
    border-right: 3px solid var(--primary-color, #6366f1);
}

.sidebar-nav i {
    width: 20px;
    text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
    position: relative;
    bottom: auto;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
    
    flex-shrink: 0;
}

/* Mobile: Adjust sidebar footer for scrolling */
@media (max-width: 1023px) {
    .sidebar-footer {
        position: relative;
    }
}

/* ============================================
   Body Scroll Lock (when sidebar is open)
   ============================================ */

body.sidebar-open {
    overflow: hidden;
}

/* Desktop: Allow body scroll */
@media (min-width: 1024px) {
    body.sidebar-open {
        overflow: auto;
    }
}

/* ============================================
   Touch Gestures Support
   ============================================ */

/* Prevent text selection during swipe */
.sidebar.swiping {
    user-select: none;
    -webkit-user-select: none;
}

/* ============================================
   Accessibility
   ============================================ */

/* ARIA attributes for screen readers */
.sidebar[aria-hidden="true"] {
    visibility: hidden;
}

.sidebar[aria-hidden="false"] {
    visibility: visible;
}

/* Visible focus indicators for keyboard navigation */
.hamburger-menu:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
    border-radius: 4px;
}

.sidebar-nav a:focus,
.sidebar-nav button:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: -3px;
    background: var(--primary-50, #eef2ff);
}

.mobile-overlay:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: -3px;
}

.notification-bell:focus,
.profile-trigger:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
    border-radius: 6px;
}

.profile-menu-item:focus,
.notification-item:focus {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: -3px;
    background: var(--primary-50, #eef2ff);
}

/* Ensure focus indicators are visible on all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

/* ============================================
   Nested Navigation (Multi-level)
   ============================================ */

.sidebar-nav .nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-nav .nav-item.expanded .nav-submenu {
    max-height: 500px;
}

.sidebar-nav .nav-submenu a {
    padding-left: 3rem;
    font-size: 0.875rem;
}

/* Expand/collapse icon */
.sidebar-nav .nav-toggle {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.sidebar-nav .nav-item.expanded .nav-toggle {
    transform: rotate(180deg);
}

/* ============================================
   Responsive Top Bar
   ============================================ */

/* Mobile: Fixed position, full width, essential controls only */
.top-bar {
    position: fixed;
    top: 0;
    left: 14px;
    right: 0;
    min-height: 56px; /* Minimum touch target height */
    z-index: 100;
    padding: 0.75rem 1rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-left h1,
.top-bar-left h2 {
    font-size: 1.125rem; /* 18px - smaller on mobile */
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Tighter spacing on mobile */
}

/* Hide profile name text on mobile to save space */
.profile-trigger span {
    display: none;
}

/* Tablet (640px+): More spacing */
@media (min-width: 640px) {
    .top-bar {
        padding: 0.875rem 1.25rem;
    }
    
    .top-bar-left h1,
    .top-bar-left h2 {
        font-size: 1.25rem; /* 20px */
    }
    
    .top-bar-right {
        gap: 0.75rem;
    }
}

/* Tablet Large (768px+): Larger text and spacing */
@media (min-width: 768px) {
    .top-bar {
        padding: 1rem 1.5rem;
        min-height: 60px;
    }
    
    .top-bar-left h1,
    .top-bar-left h2 {
        font-size: 1.5rem; /* 24px */
    }
    
    .top-bar-right {
        gap: 1rem;
    }
    
    /* Show profile name on tablet and up */
    .profile-trigger span {
        display: inline;
    }
}

/* Desktop (1024px+): Offset by sidebar width */
@media (min-width: 1024px) {
    .top-bar {
        
        padding: 1rem 2rem;
        min-height: 82px;
    }
    
    .top-bar-left {
        gap: 1rem;
    }
    
    .top-bar-left h1,
    .top-bar-left h2 {
        font-size: 1.75rem; /* 28px */
    }
    
    .top-bar-right {
        gap: 1.25rem;
    }
}

/* Desktop Large (1280px+): Even more spacing */
@media (min-width: 1280px) {
    .top-bar {
        padding: 1.25rem 2.5rem;
    }
    
    .top-bar-right {
        gap: 1.5rem;
    }
}

/* ============================================
   Top Bar - Notification Bell Responsive
   ============================================ */

.notification-bell {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    font-size: 0.75rem;
}

/* Tablet and up: Slightly larger badge */
@media (min-width: 768px) {
    .notification-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.8125rem;
    }
}

/* ============================================
   Top Bar - Profile Dropdown Responsive
   ============================================ */

.profile-trigger {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* Tablet and up: Larger avatar and spacing */
@media (min-width: 768px) {
    .profile-trigger {
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
    }
    
    .profile-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Desktop: Full size */
@media (min-width: 1024px) {
    .profile-trigger {
        padding: 0.5rem 1rem;
    }
    
    .profile-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }
}

/* ============================================
   Profile Dropdown Menu - Mobile Responsive
   ============================================ */

/* Mobile: Full-width dropdown positioned below trigger */
.profile-menu {
    position: fixed;
    top: auto;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
    margin-top: 0.5rem;
}

/* Touch-friendly menu items with minimum 44px height */
.profile-menu-item {
    min-height: 44px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

/* Adequate spacing for touch targets */
.profile-menu-item i {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

/* Clear visual feedback on touch */
.profile-menu-item:active {
    background-color: var(--gray-100);
    transform: scale(0.98);
}

/* Divider spacing */
.profile-menu-divider {
    margin: 0.25rem 0;
}

/* Tablet (640px+): Slightly narrower, positioned from right */
@media (min-width: 640px) {
    .profile-menu {
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 0;
        left: auto;
        width: 240px;
        margin-top: 0;
    }
}

/* Tablet Large (768px+): Standard dropdown width */
@media (min-width: 768px) {
    .profile-menu {
        width: 220px;
    }
    
    .profile-menu-item {
        min-height: auto;
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }
    
    .profile-menu-item i {
        width: 1.25rem;
        height: auto;
        font-size: 1rem;
    }
}

/* Desktop (1024px+): Compact dropdown */
@media (min-width: 1024px) {
    .profile-menu {
        width: 200px;
    }
    
    .profile-menu-item {
        padding: 0.75rem 1rem;
    }
}

/* ============================================
   Notification Panel - Mobile Responsive
   ============================================ */

/* Mobile: Full-width panel positioned below trigger */
.notification-panel {
    position: fixed;
    top: auto;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
    margin-top: 0.5rem;
    max-height: 70vh; /* Limit height to avoid off-screen rendering */
}

/* Notification header - touch-friendly */
.notification-header {
    padding: 1rem;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Mark all read button - touch-friendly */
.mark-all-read {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Notification list - scrollable with adequate height */
.notification-list {
    max-height: calc(70vh - 140px); /* Account for header and footer */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Touch-friendly notification items with minimum 44px height */
.notification-item {
    min-height: 44px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Clear visual feedback on touch */
.notification-item:active {
    background-color: var(--gray-100);
    transform: scale(0.98);
}

/* Adequate spacing for notification dot */
.notification-dot {
    width: 0.625rem;
    height: 0.625rem;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

/* Notification content - readable text size */
.notification-content {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.notification-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.notification-message {
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.8125rem;
}

/* Notification footer - touch-friendly */
.notification-footer {
    padding: 1rem;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-all-notifications {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
}

/* Tablet (640px+): Slightly narrower, positioned from right */
@media (min-width: 640px) {
    .notification-panel {
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 0;
        left: auto;
        width: 360px;
        margin-top: 0;
        max-height: 500px;
    }
    
    .notification-list {
        max-height: 360px;
    }
}

/* Tablet Large (768px+): Standard dropdown width */
@media (min-width: 768px) {
    .notification-panel {
        width: 380px;
    }
    
    .notification-header {
        padding: 0.875rem 1rem;
        min-height: auto;
    }
    
    .notification-header h3 {
        font-size: 1rem;
    }
    
    .mark-all-read {
        min-height: auto;
        min-width: auto;
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .notification-item {
        min-height: auto;
        padding: 0.875rem 1rem;
    }
    
    .notification-title {
        font-size: 0.9375rem;
    }
    
    .notification-message {
        font-size: 0.875rem;
    }
    
    .notification-time {
        font-size: 0.75rem;
    }
    
    .notification-footer {
        padding: 0.875rem 1rem;
        min-height: auto;
    }
    
    .view-all-notifications {
        min-height: auto;
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Desktop (1024px+): Compact dropdown */
@media (min-width: 1024px) {
    .notification-panel {
        width: 380px;
        max-height: 500px;
    }
    
    .notification-list {
        max-height: 400px;
    }
}

/* ============================================
   Top Bar - Adjust main content for fixed top bar
   ============================================ */



