/* Sidebar Styles - Matching React design from LactoSync.Design */

.sidebar-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-custom {
    background-color: white;
    border-right: 1px solid var(--gray-200);
    height: calc(100vh - 73px);
    position: fixed;
    left: 0;
    top: 73px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 40;
}

    .sidebar-custom.sidebar-open {
        width: 256px; /* w-64 = 16rem = 256px */
        transform: translateX(0);
        box-shadow: none;
    }

    .sidebar-custom.sidebar-closed {
        width: 80px; /* w-20 = 5rem = 80px */
        transform: translateX(0);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
    }

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* gap-3 */
    padding: 0.75rem 1rem; /* px-4 py-3 */
    border-radius: var(--border-radius-lg); /* rounded-lg */
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s ease; /* transition-all duration-200 */
    font-size: 0.875rem; /* text-sm */
    font-weight: var(--font-weight-medium);
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
    text-align: left;
    justify-content: flex-start;
    position: relative;
}

    .sidebar-menu-item:hover:not(.disabled):not(.active) {
        background-color: var(--gray-50); /* hover:bg-gray-50 */
        color: var(--gray-900); /* hover:text-gray-900 */
    }

    .sidebar-menu-item.active {
        background-color: var(--blue-50); /* bg-blue-50 */
        color: var(--blue-600); /* text-blue-600 */
        font-weight: var(--font-weight-semibold);
    }

    .sidebar-menu-item.disabled {
        color: var(--gray-400); /* text-gray-400 */
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Collapsed state - center icon only */
    .sidebar-menu-item.sidebar-collapsed {
        justify-content: center;
        padding: 0.75rem;
        gap: 0;
    }

/* Icon styling */
.sidebar-icon {
    flex-shrink: 0;
    width: 1.25rem; /* w-5 */
    height: 1.25rem; /* h-5 */
}

.sidebar-menu-item.sidebar-collapsed .sidebar-icon {
    margin: 0 auto; /* mx-auto when collapsed */
}

/* Label styling */
.sidebar-label {
    transition: all 0.3s ease; /* transition-all duration-300 */
    white-space: nowrap;
    text-align: left;
    flex: 1;
}

.sidebar-label-visible {
    opacity: 1;
    transform: translateX(0);
    width: auto;
    display: inline-block;
}

.sidebar-label-hidden {
    opacity: 0;
    transform: translateX(-16px); /* -translate-x-4 */
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    display: none;
}

/* Page Count Badge - matching React design */
.sidebar-count-badge {
    background-color: var(--blue-100); /* bg-blue-100 */
    color: var(--blue-600); /* text-blue-600 */
    font-size: 0.75rem; /* text-xs */
    font-weight: var(--font-weight-semibold);
    padding: 0.125rem 0.5rem; /* px-2 py-0.5 */
    border-radius: var(--border-radius-full); /* rounded-full */
    margin-left: auto; /* ml-auto */
    flex-shrink: 0;
}

/* Tooltip for collapsed sidebar items - matching React design */
.sidebar-tooltip {
    position: absolute;
    left: calc(100% + 0.5rem); /* ml-2 */
    padding: 0.5rem 0.75rem; /* px-3 py-2 */
    background-color: var(--gray-900); /* bg-gray-900 */
    color: white;
    font-size: 0.875rem; /* text-sm */
    border-radius: var(--border-radius-lg); /* rounded-lg */
    opacity: 0;
    transition: opacity 0.2s ease; /* transition-opacity duration-200 */
    pointer-events: none;
    white-space: nowrap;
    z-index: 50;
    display: none; /* Hidden by default */
    align-items: center;
    gap: 0.5rem; /* gap-2 */
}

.sidebar-menu-item.sidebar-collapsed:hover .sidebar-tooltip {
    opacity: 1;
    display: flex;
}

/* Badge inside tooltip - matching React design */
.sidebar-tooltip-badge {
    background-color: var(--blue-500); /* bg-blue-500 */
    color: white;
    font-size: 0.625rem; /* text-[10px] */
    padding: 0.125rem 0.375rem; /* px-1.5 py-0.5 */
    border-radius: var(--border-radius-full); /* rounded-full */
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
    top: 73px;
}

/* Main Content Area */
.main-content-wrapper {
    padding: 1.5rem;
    background-color: var(--gray-50);
    transition: all 0.3s ease-in-out;
    min-height: calc(100vh - 73px);
}

/* Responsive Design - Matching React design */
@media (max-width: 1023px) {
    .sidebar-custom.sidebar-open {
        width: 256px; /* w-64 */
        transform: translateX(0);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
    }

    .sidebar-custom.sidebar-closed {
        transform: translateX(-100%); /* -translate-x-full */
        width: 256px; /* w-64 */
    }

    .main-content-wrapper.sidebar-open {
        margin-left: 0;
    }

    .main-content-wrapper.sidebar-closed {
        margin-left: 0;
    }

    .sidebar-backdrop {
        display: block;
    }
}

@media (min-width: 1024px) {
    .sidebar-backdrop {
        display: none !important;
    }

    .sidebar-custom.sidebar-open {
        box-shadow: none; /* lg:shadow-none */
    }

    .sidebar-custom.sidebar-closed {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
    }
}

/* Additional responsive styles */
@media (max-width: 768px) {
    .sidebar-custom {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .main-content-wrapper {
        margin-left: 0;
    }
}

/* New React-style Sidebar */
.sidebar-react-style {
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    height: calc(100vh - 73px);
    position: fixed;
    left: 0;
    top: 73px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 40;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    .sidebar-react-style.sidebar-open {
        width: 16rem; /* 256px */
    }

    .sidebar-react-style.sidebar-closed {
        width: 5rem; /* 80px */
    }

.sidebar-nav-react {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Icon-only mode when collapsed */
.sidebar-icon-only {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-icon-item-wrapper {
    position: relative;
    margin-bottom: 0.25rem;
}

.sidebar-icon-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .sidebar-icon-button:hover:not(.disabled):not(.active) {
        background-color: white;
    }

    .sidebar-icon-button.active {
        background: linear-gradient(to right, #dbeafe, #e0e7ff);
    }

    .sidebar-icon-button.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

    .sidebar-icon-button .mud-icon-root {
        width: 1.25rem;
        height: 1.25rem;
    }

/* Tooltip for collapsed icons */
.sidebar-tooltip-react {
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    padding: 0.375rem 0.75rem;
    background-color: #1e293b;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-tooltip-badge-react {
    background-color: #2563eb;
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
}

/* Expanded mode with groups */
.sidebar-groups {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-group {
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-group-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.sidebar-group-items {
    padding: 0.375rem;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-group-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}

.sidebar-group-item > span:first-of-type {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .sidebar-group-item:hover:not(.disabled):not(.active) {
        background-color: #dbeafe;
        color: #1e3a8a;
    }

    .sidebar-group-item.active {
        background-color: #dbeafe;
        color: #1e3a8a;
        font-weight: 600;
    }

    .sidebar-group-item.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

.sidebar-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    flex-shrink: 0;
}

/* Main Content Wrapper - Fixed positioning */
.main-content-wrapper.sidebar-open {
    margin-left: 16rem; /* 256px */
}

.main-content-wrapper.sidebar-closed {
    margin-left: 5rem; /* 80px */
}

/* Responsive adjustments */
@media (max-width: 1023px) {
    .sidebar-react-style.sidebar-closed {
        transform: translateX(-100%);
    }

    .main-content-wrapper.sidebar-open,
    .main-content-wrapper.sidebar-closed {
        margin-left: 0;
    }
}
