/* Universal Sidebar Styles */
#sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    height: 100vh;
}

#sidebar-change {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden;
}

#sidebar-change .sidebar-text {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    display: none;
    white-space: nowrap;
}

#sidebar-change.w-64 .sidebar-text {
    opacity: 1;
    transform: translateX(0);
    display: inline-block !important;
}

#sidebar-change .sidebar-badge {
    opacity: 0;
    transition: opacity 0.25s ease;
    display: none;
}

#sidebar-change.w-64 .sidebar-badge {
    opacity: 1;
    display: inline-block !important;
}

#sidebar-change .sidebar-icon {
    transition: opacity 0.2s ease;
}

#sidebar-change.w-64 .sidebar-icon {
    display: none;
}

/* Default body margin for minimized sidebar */
body {
    margin-left: 64px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded sidebar body margin */
body.sidebar-expanded {
    margin-left: 256px;
}

/* For pages using flex h-screen layout (index) */
#main-wrapper {
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-width: 0;
}

/* Tooltip styles for minimized sidebar */
.sidebar-item {
    position: relative;
}

.sidebar-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    z-index: 1001;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

.sidebar-item[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* Hide tooltips when sidebar is expanded */
.w-64 .sidebar-item[data-tooltip]:hover::after,
.w-64 .sidebar-item[data-tooltip]:hover::before {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        margin-left: 0 !important;
    }
    
    body.sidebar-expanded {
        margin-left: 0 !important;
    }
    
    #sidebar-container {
        transform: translateX(-100%);
        transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    body.sidebar-expanded #sidebar-container {
        transform: translateX(0);
    }
    
    /* Overlay for mobile */
    body.sidebar-expanded::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}