/* ============================================
   SIDEBAR NAVIGATION STYLES
   ============================================ */

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: linear-gradient(180deg, #0077BE 0%, #005A94 100%);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 70px;
}

/* Sidebar Header - Improved Design */
.sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    min-height: 80px;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon i {
    font-size: 1.3rem;
    color: white;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.2s ease, width 0.2s ease;
}

.sidebar-brand .brand-title {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.sidebar-brand .brand-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand .brand-text {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0077BE 0%, #005A94 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    z-index: 1002;
}

/* Toggle Button */
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sidebar.collapsed .sidebar-toggle:hover {
    transform: translateX(-50%) scale(1.05);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Navigation Links */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

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

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-link span {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

/* Divider */
.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 1.25rem;
}

.sidebar.collapsed .nav-divider {
    margin: 0.75rem 0.5rem;
}

/* User Section at Bottom */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.75rem 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.user-details .user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-details .user-role {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .user-info {
    padding: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

/* Notification Status */
.notification-status {
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem;
}

.notification-status:hover {
    background: rgba(255, 255, 255, 0.1);
}


.notification-status i:first-child {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sidebar.collapsed .notification-status .notification-text {
    display: none;
}

.sidebar.collapsed .notification-status {
    justify-content: center;
    padding: 0.5rem 0;
}

/* Logout Link in Footer */
.logout-link {
    color: #fca5a5 !important;
    margin-top: 0.25rem;
    padding: 0.6rem 0.5rem !important;
    border-left: none !important;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fecaca !important;
}

.sidebar.collapsed .logout-link {
    justify-content: center;
    padding: 0.6rem 0 !important;
}

.sidebar.collapsed .logout-link span {
    display: none;
}

/* Tooltip for collapsed state */
.nav-link[data-tooltip] {
    position: relative;
}

.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-left: 10px;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed .nav-link::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-left: -2px;
}

.sidebar.collapsed .nav-link:hover::after,
.sidebar.collapsed .nav-link:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed~.main-wrapper {
    margin-left: 70px;
}

/* Adjust container for sidebar layout */
.main-wrapper .container {
    max-width: 1400px;
    padding: 1.5rem 2rem;
    margin: 0 auto;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: flex !important;
    }
}

/* Mobile menu button (hidden by default on desktop) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 999;
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 992px) {
    .sidebar-overlay.active {
        display: block;
    }
}