/**
 * Sidebar Component Styles
 * Shared styles for the navigation sidebar across all pages
 */

/* Navigation Sidebar */
.nav-sidebar {
    position: fixed;
    top: 100px;
    z-index: 9998;
    transition: all 0.1s ease-in-out;
    overflow-y: auto;
    transform: translateX(0);
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    touch-action: pan-y; /* Enable vertical scrolling on touch devices */
}

/* Show logo when sidebar is open, even in home mode */
body:has(.nav-sidebar.open) .global-header.home-mode .header-logo {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, -50%) translateY(0) !important;
    animation: none !important;
}

/* Hide section title and right container when sidebar is open */
body:has(.nav-sidebar.open) .global-header .header-left .section-title,
body:has(.nav-sidebar.open) .global-header .header-right {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Hide task-related elements that get moved to header by JS */
body:has(.nav-sidebar.open) .global-header .search-container,
body:has(.nav-sidebar.open) .global-header .task-count-container,
body:has(.nav-sidebar.open) .global-header #tasks-search,
body:has(.nav-sidebar.open) .global-header #task-count-display {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

/* Single column mode (not logged in) - fixed width sidebar with blur */
.nav-sidebar-single-column {
    width: 280px;
    left: -280px;
    border-radius: 0 20px 20px 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Multi column mode (logged in) - full screen responsive with solid background */
.nav-sidebar-multi-column {
    width: 100vw;
    height: 100vh;
    left: -100vw;
    border-radius: 0;
    background: rgba(255, 255, 255, 1) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.nav-sidebar-single-column.open {
    top: 100px;
    left: 23px;
    transform: translateX(0) scale(1);
}

.nav-sidebar-multi-column.open {
    top: 0px;
    padding-top: 90px;
    left: 0;
    transform: translateX(0) scale(1);
}

.nav-sidebar:not(.open) {
    transform: translateX(-10px) scale(0.98);
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.close-nav {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-nav:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.nav-menu {
    padding: 0px 0;
    display: flex;
    flex-direction: row;
    gap: 0;
    height: 100%;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    touch-action: pan-y; /* Enable vertical scrolling on touch devices */
}

/* Column styling for single column mode */
.nav-sidebar-single-column .nav-column {
    display: flex;
    flex-direction: column;
    width: 280px;
    flex-shrink: 0;
}

/* Column styling for multi-column mode - flexible width */
.nav-sidebar-multi-column .nav-menu {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    padding: 0 20px;
    gap: 0;
    height: 100%;
}

.nav-sidebar-multi-column .nav-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    touch-action: pan-y; /* Enable vertical scrolling on touch devices */
}

.nav-sidebar-multi-column .nav-column:last-child {
    border-right: none;
}

/* Custom scrollbar for columns */
.nav-sidebar-multi-column .nav-column::-webkit-scrollbar {
    width: 6px;
}

.nav-sidebar-multi-column .nav-column::-webkit-scrollbar-track {
    background: transparent;
}

.nav-sidebar-multi-column .nav-column::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.nav-sidebar-multi-column .nav-column::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Insights Chart */
.insights-chart-container {
    padding: 0 20px 15px 20px;
    margin-bottom: 10px;
}

/* Hide chart containers initially when sidebar is open */
.nav-sidebar.open .insights-chart-container {
    opacity: 0;
}

.chart-title {
    font-size: 10px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 12px;
}

.chart-canvas-wrapper {
    position: relative;
    height: 150px;
    width: 100%;
}

#insights-chart-canvas {
    max-height: 150px;
}

/* Section Headers */
.nav-section-header {
    padding: 15px 20px 10px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    background: transparent;
    pointer-events: none;
    user-select: none;
}

/* Section Divider */
.nav-section-divider {
    height: 10px;
    background: transparent;
}

.nav-margin-bottom{
    background: rgba(255, 255, 255, 0.9);
    margin-bottom: 5px!important;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    transition: all 0.2s;
    position: relative;
    min-height: 50px;
    box-sizing: border-box;

    margin: 0 ;
    background: rgba(255, 255, 255, 0.9);
}

.nav-item:has(.nav-label) {
    align-items: flex-start;
    padding-top: 8px;
    padding-bottom: 8px;
}

.nav-item-content {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 1;
}

.nav-item:has(.nav-label) .nav-label {
    position: absolute;
    top: 10px;
    left: 55px; /* 20px (padding) + 20px (icon width) + 15px (icon margin-right) */
    font-size: 10px;
    font-weight: 400;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    height: auto;
    z-index: 2;
}

.nav-item:has(.nav-label) .nav-item-content {
    margin-top: 12px;
    align-items: center;
    z-index: 1;
    position: relative;
}

.nav-item:hover {
    background: -webkit-linear-gradient(left, rgb(232, 94, 83), rgb(142, 49, 187), rgb(102, 173, 214));
    border-left-color: #000000;
    color: #FFFFFF;
}

.nav-item:hover .nav-label {
    color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
    background: -webkit-linear-gradient(left, rgb(232, 94, 83), rgb(142, 49, 187), rgb(102, 173, 214));
    border-left-color: #000000;
    color: #FFFFFF;
}

.nav-item.active .nav-label {
    color: rgba(255, 255, 255, 0.9);
}

/* Disabled nav items */
.nav-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-item-disabled:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
}

.nav-item-disabled .nav-icon i {
    opacity: 0.5;
}

.nav-icon {
    margin-right: 15px !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.nav-icon i {
    font-size: 20px;
    color: inherit;
}

.nav-text {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 1px;
    line-height: 20px;
}

.nav-label {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #999;
    margin-bottom: 2px;
    text-transform: none;
    letter-spacing: 0.5px;
}

.nav-text2 {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #666;
    margin-top: 2px;
}
/* Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9997; /* Below sidebar (9998) and global header (99999), above content */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.nav-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Hamburger Menu */
.hamburger-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 15px;
    height: 15px;
    z-index: 10;
    cursor: pointer;
}

.hamburger-menu .line {
    width: 100%;
    height: 2px;
    background: black;
    margin: 3px 0;
    border-radius: 1px;
}

/* Add padding to specific sections */
#users-section,
#roles-section,
#clients-section,
#projects-section,
#receipts-section {
    padding-top: 100px;
}

/* Ensure fixed buttons are below the sidebar */
.fixed-book-btn-container.workshop-btn,
.fixed-book-btn-container.team-btn,
.fixed-book-btn-container.business-kit-btn {
    z-index: 9990 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-sidebar-single-column {
        width: 280px;
        left: -280px;
    }

    .nav-sidebar-multi-column {
        width: 100vw;
        left: -100vw;
    }

    .nav-sidebar.open {
        left: 0;
    }

    .hamburger-menu {
        top: 15px;
        left: 15px;
    }

    /* Stack columns vertically on mobile */
    .nav-menu {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        height: calc(100vh - 90px); /* Account for header height */
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        overscroll-behavior: contain; /* Prevent overscroll bounce */
    }

    .nav-column {
        width: 100% !important;
        flex: none !important;
        min-width: 100% !important;
        max-width: 100% !important;
        max-height: none; /* Allow columns to expand */
        overflow-y: visible; /* Let parent handle scrolling */
        overflow-x: hidden;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    /* Ensure multi-column mode columns are also 100% width on mobile */
    .nav-sidebar-multi-column .nav-column {
        width: 100% !important;
        flex: none !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    .nav-column:last-child {
        border-bottom: none;
    }

    /* Ensure sidebar container can scroll */
    .nav-sidebar-multi-column {
        overflow-y: auto;
        overflow-x: hidden;
        height: 100vh;
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        overscroll-behavior: contain; /* Prevent overscroll bounce */
        position: fixed;
        top: 0;
    }

    /* Custom scrollbar for mobile sidebar */
    .nav-sidebar-multi-column::-webkit-scrollbar {
        width: 8px;
    }

    .nav-sidebar-multi-column::-webkit-scrollbar-track {
        background: transparent;
    }

    .nav-sidebar-multi-column::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

    .nav-sidebar-multi-column::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    .nav-margin-bottom {
        margin-bottom: 0 !important;
    }
}

@media (max-width: 480px) {
    .nav-sidebar {
        width: 100vw;
        left: -100vw;
        border-radius: 0;
        top: 90px;
        overflow-y: auto;
        overflow-x: hidden;
        height: calc(100vh - 90px);
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        overscroll-behavior: contain; /* Prevent overscroll bounce */
        position: fixed;
    }
    
    .nav-sidebar.open {
        left: 0;
        top: 90px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        overscroll-behavior: contain; /* Prevent overscroll bounce */
    }

    /* Ensure menu scrolls on very small devices */
    .nav-menu {
        overflow-y: auto;
        overflow-x: hidden;
        height: 100%;
        -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
        overscroll-behavior: contain; /* Prevent overscroll bounce */
    }

    .nav-margin-bottom {
        margin-bottom: 0 !important;
    }
}

/* Cascade animation for columns when sidebar opens */
@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animation to columns when sidebar is open */
.nav-sidebar.open .nav-column-animate {
    animation: slideInFromLeft 0.4s ease-out forwards;
    opacity: 0;
}

/* Reset animation when sidebar is closed */
.nav-sidebar:not(.open) .nav-column-animate {
    opacity: 1;
    animation: none;
}

/* Activity item animation */
@keyframes activitySlideIn {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animation to activity items when sidebar is open */
.nav-sidebar.open .activity-item-animate {
    animation: activitySlideIn 0.25s ease-out forwards;
}

/* Reset animation when sidebar is closed */
.nav-sidebar:not(.open) .activity-item-animate {
    opacity: 1;
    animation: none;
}

/* Activity Feed Styles */
.activity-feed {
    padding: 0 20px 20px 20px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
}

/* Hide activity items initially when sidebar is open */
.nav-sidebar.open .activity-item[data-activity-index] {
    opacity: 0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: rgba(0, 0, 0, 0.02);
    margin: 0 -8px;
    padding: 12px 8px;
    border-radius: 8px;
}

.activity-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.activity-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-text {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

.activity-text strong {
    font-weight: 600;
    color: #000;
}

.activity-time {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}
