/* Resizable Sidebar Styles - Tabler Compatible */
.page.page-with-resizer {
    position: relative;
}

/* Override Tabler's default sidebar styles for resizable version */
.sidebar-resizable.navbar-vertical {
    position: fixed !important;
    top: 0;
    left: 0;
    width: var(--sidebar-width, 280px) !important;
    min-width: 200px;
    max-width: 500px;
    height: 100vh;
    z-index: 1030;
    transition: width 0.2s ease;
    flex-shrink: 0;
}

/* Sidebar resizer handle */
.sidebar-resizer {
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 280px);
    width: 6px;
    height: 100vh;
    background: rgba(255, 0, 0, 0.1); /* Temporary debug background */
    cursor: ew-resize;
    z-index: 1040;
    user-select: none;
    transition: left 0.2s ease;
}

.sidebar-resizer:hover .resizer-handle,
.sidebar-resizer.dragging .resizer-handle {
    background: var(--tblr-primary, #206bc4);
    opacity: 1;
}

.resizer-handle {
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto;
    opacity: 0;
    transition: all 0.2s ease;
}

/* Adjust page wrapper to account for resizable sidebar */
.page.page-with-resizer .page-wrapper {
    margin-left: var(--sidebar-width, 280px) !important;
    transition: margin-left 0.2s ease;
    width: calc(100% - var(--sidebar-width, 280px));
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .sidebar-resizable.navbar-vertical {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        max-width: none;
    }
    
    .sidebar-resizer {
        display: none !important;
    }
    
    .page.page-with-resizer .page-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Resizing states */
.sidebar-resizer.dragging {
    background: rgba(32, 107, 196, 0.1);
}

.sidebar-resizer.dragging::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1035;
    pointer-events: none;
}

body.resizing {
    cursor: ew-resize !important;
    user-select: none;
}

body.resizing * {
    pointer-events: none;
}

body.resizing .sidebar-resizer {
    pointer-events: auto;
}

/* Ensure sidebar content doesn't overflow */
.sidebar-resizable .container-fluid {
    width: 100%;
    min-width: 0;
    padding-right: 1rem;
}

.sidebar-resizable .navbar-nav {
    width: 100%;
}

/* Visual indicator for resizer */
.sidebar-resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 40px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.4) 0px,
        rgba(255, 255, 255, 0.4) 2px,
        transparent 2px,
        transparent 4px
    );
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 2px;
}

.sidebar-resizer:hover::before,
.sidebar-resizer.dragging::before {
    opacity: 1;
}

/* Smooth transitions for sidebar content */
.sidebar-resizable .navbar-brand span,
.sidebar-resizable .nav-link-title {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Adaptive content based on sidebar width */
.sidebar-narrow .navbar-brand span {
    opacity: 0;
    transform: scale(0.8);
}

.sidebar-narrow .nav-link-title {
    opacity: 0;
    transform: translateX(-10px);
}

/* Tooltip for narrow sidebar */
.sidebar-narrow .nav-link {
    position: relative;
}

.sidebar-narrow .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1050;
    margin-left: 8px;
    font-size: 12px;
}

/* Responsive adjustments */
@media (min-width: 992px) {
    .page.page-with-resizer {
        overflow-x: hidden;
    }
}

/* Ensure proper z-index stacking */
.sidebar-resizable {
    z-index: 1030;
}

.sidebar-resizer {
    z-index: 1040;
}

/* Loading state */
.sidebar-resizer.loading {
    pointer-events: none;
    opacity: 0.5;
}