/* ========================================
   DESKTOP SIDEBAR STYLES (EXISTING)
   ======================================== */

/* Sidebar Container */
.sidebar {
    min-height: 100vh;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    border-right: 1px solid #e9ecef;
    background-color: #ffffff;
    position: relative;
}

/* Logo Section */
.sidebar-header {
    border-bottom: 1px solid #f1f3f4;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem !important;
}

.logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Navigation Styles */
.sidebar-nav {
    padding: 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

/* Main Navigation Links */
.sidebar-link {
    color: #6c757d;
    text-decoration: none;
    border-radius: 8px;
    margin: 0 12px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    position: relative;
}

.sidebar-link:hover {
    background-color: #f8f9fa;
    color: #495057;
    text-decoration: none;
    transform: translateX(2px);
}

/* Dashboard Active State (Direct Link) */
.sidebar-link.active {
    background-color: #e7f3ff;
    color: #0d6efd;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background-color: #0d6efd;
    border-radius: 2px;
}

/* Parent Active State (When child is active) */
.sidebar-link.parent-active {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
}

/* Dropdown Arrow */
.dropdown-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
    color: #adb5bd;
}

.dropdown-arrow.rotated {
    transform: rotate(180deg);
}

/* Dropdown Toggle Styling */
.dropdown-toggle {
    cursor: pointer;
}

.dropdown-nav.expanded .sidebar-link {
    background-color: #f8f9fa;
    color: #495057;
}

/* Icon Styling */
.sidebar-link i:first-child {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 16px;
}

/* Dropdown Menu */
.dropdown-menu-custom {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-left: 12px;
    margin-right: 12px;
    background-color: #fbfbfb;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
}

.dropdown-menu-custom.show {
    max-height: 400px;
    opacity: 1;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 8px 0;
}

/* Dropdown Items */
.dropdown-item-custom {
    color: #6c757d;
    text-decoration: none;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border-radius: 6px;
    margin: 2px 8px;
}

.dropdown-item-custom:hover {
    background-color: #ffffff;
    color: #495057;
    text-decoration: none;
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Active Dropdown Item */
.dropdown-item-custom.active {
    background-color: #e7f3ff;
    color: #0d6efd;
    font-weight: 600;
    position: relative;
}

.dropdown-item-custom.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background-color: #0d6efd;
    border-radius: 2px;
}

.dropdown-item-custom.active i {
    color: #0d6efd;
}

/* Dropdown Item Icons */
.dropdown-item-custom i {
    width: 18px;
    text-align: center;
    margin-right: 12px;
    font-size: 14px;
    color: #adb5bd;
}

/* Hover Effects */
.dropdown-item-custom:hover i {
    color: #495057;
}

/* User Profile Section (Desktop) */
.user-profile-section {
    max-width: inherit;
}

@media (min-width: 768px) {
    .user-profile-section {
        width: 16.66666667% !important;
        max-width: 16.66666667%;
    }
}

@media (min-width: 992px) {
    .user-profile-section {
        width: 16.66666667% !important;
        max-width: 16.66666667%;
    }
}

/* ========================================
   MOBILE NAVIGATION STYLES (NEW)
   ======================================== */

/* Mobile Navigation Bar */
@media (max-width: 767.98px) {
    body {
        padding-top: 56px; /* Height of mobile navbar */
    }
}

@media (min-width: 768px) {
    body {
        padding-top: 0 !important;
    }
}

/* Mobile Navigation Styles */
.mobile-nav .nav-link {
    padding: 0.75rem 1.25rem;
    color: #495057;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.mobile-nav-link:hover {
    background-color: #f8f9fa;
    color: #0d6efd;
    text-decoration: none;
}

.mobile-nav-link.active {
    background-color: #0d6efd;
    color: white !important;
}

.mobile-nav-link.parent-active {
    background-color: #e7f1ff;
    color: #0d6efd !important;
}

/* Mobile Dropdown Styles */
.mobile-dropdown-menu {
    display: none;
    background-color: #f8f9fa;
    padding: 0;
    margin: 0;
    list-style: none;
    border-top: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.mobile-dropdown-menu.show {
    display: block;
    animation: slideDownMobile 0.3s ease-out;
}

.mobile-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 3rem;
    color: #6c757d;
    text-decoration: none;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-dropdown-item:hover {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
    transform: translateX(4px);
}

.mobile-dropdown-item.active {
    background-color: #0d6efd;
    color: white !important;
    font-weight: 600;
}

.mobile-dropdown-arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
    color: #adb5bd;
}

.mobile-dropdown-arrow.rotated {
    transform: rotate(180deg);
}

/* Mobile Icon Spacing */
.mobile-nav-link i,
.mobile-dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Active States for Mobile */
.mobile-nav-link.active i,
.mobile-dropdown-item.active i {
    color: white;
}

/* Offcanvas Improvements */
.offcanvas-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

.offcanvas-header {
    padding: 1rem 1.25rem;
}

/* Custom Navbar Toggler */
.navbar-toggler {
    border: none !important;
    box-shadow: none !important;
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Mobile Profile Section */
.offcanvas .user-profile-section {
    margin-top: auto;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.25rem;
}

/* ========================================
   RESPONSIVE DESIGN ADJUSTMENTS
   ======================================== */

/* Original responsive design for desktop sidebar */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar::after {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar.show::after {
        opacity: 1;
        pointer-events: auto;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ========================================
   ANIMATIONS AND TRANSITIONS
   ======================================== */

/* Mobile dropdown animation */
@keyframes slideDownMobile {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Existing animations */
@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 400px;
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        max-height: 400px;
        opacity: 1;
    }
    to {
        max-height: 0;
        opacity: 0;
    }
}

/* ========================================
   ACCESSIBILITY AND INTERACTION
   ======================================== */

/* Focus States for Accessibility */
.sidebar-link:focus,
.dropdown-item-custom:focus,
.mobile-nav-link:focus,
.mobile-dropdown-item:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Smooth Animations */
.sidebar-link,
.dropdown-item-custom,
.dropdown-arrow,
.mobile-nav-link,
.mobile-dropdown-item,
.mobile-dropdown-arrow {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading States */
.sidebar-link.loading,
.mobile-nav-link.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Touch Target Improvements for Mobile */
@media (max-width: 767.98px) {
    .mobile-nav-link,
    .mobile-dropdown-item {
        min-height: 48px; /* Minimum touch target size */
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Badge Support (for future use) */
.nav-badge {
    background-color: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
}

/* Divider Support */
.nav-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 8px 12px;
}

/* Mobile Divider */
.mobile-nav-divider {
    height: 1px;
    background-color: #dee2e6;
    margin: 0.5rem 1.25rem;
}

/* Custom Scrollbar for Dropdown */
.dropdown-menu-custom::-webkit-scrollbar {
    width: 4px;
}

.dropdown-menu-custom::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 2px;
}

.dropdown-menu-custom::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 2px;
}

.dropdown-menu-custom::-webkit-scrollbar-thumb:hover {
    background: #9fadbc;
}

/* ========================================
   LOGO RESPONSIVE SIZING
   ======================================== */

@media (min-width: 576px) {
    .company-logo {
        height: 48px !important;
    }
}

@media (min-width: 768px) {
    .company-logo {
        height: 56px !important;
    }
}

@media (min-width: 992px) {
    .company-logo {
        height: 64px !important;
    }
}

/* Mobile logo sizing */
@media (max-width: 575.98px) {
    .navbar-brand img {
        height: 30px !important;
    }

    .offcanvas-header img {
        height: 35px !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .sidebar,
    .navbar,
    .offcanvas {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body {
        padding-top: 0 !important;
    }
}
