/**
 * Sidebar layout variants — scoped to body.sidebar-*
 */

/* ── CLASSIC ── */
body.sidebar-classic #side-bar {
    width: 250px;
    max-width: 250px;
    background: var(--sidebar-bg);
    box-shadow: 4px 0 24px var(--shadow-color);
    border-right: 1px solid var(--border-color);
}

body.sidebar-classic #sidebar-menu .sidebar-menu-header {
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 1rem;
}

body.sidebar-classic #sidebar-menu .sidebar-menu-header:first-child {
    border-top: none;
}

body.sidebar-classic #sidebar-menu a,
body.sidebar-classic #sidebar-menu .drop_down {
    border-left: 3px solid transparent;
    border-radius: 0 0.375rem 0.375rem 0;
}

body.sidebar-classic #sidebar-menu a:hover,
body.sidebar-classic #sidebar-menu .drop_down:hover,
body.sidebar-classic #sidebar-menu .theme-sidebar-active,
body.sidebar-classic #sidebar-menu .drop_down.theme-sidebar-active {
    border-left-color: var(--accent-color);
    background: var(--sidebar-active-bg);
}

/* ── COMPACT (icon rail) ── */
body.sidebar-compact #side-bar {
    width: 65px;
    max-width: 65px;
    overflow: visible;
    z-index: 40;
}

body.sidebar-compact .sidebar-brand .side-bar-heading,
body.sidebar-compact .sidebar-brand .sidebar-custom-logo + .side-bar-heading {
    display: none;
}

body.sidebar-compact .sidebar-brand {
    padding: 0.5rem;
    min-height: 60px;
}

body.sidebar-compact .sidebar-brand .sidebar-custom-logo {
    max-height: 2rem;
    max-width: 2rem;
    border-radius: 0.375rem;
}

body.sidebar-compact .sidebar-brand .sidebar-monogram {
    display: inline-flex;
}

body.sidebar-compact .sidebar-brand .side-bar-heading {
    font-size: 0.65rem;
    line-height: 1.1;
    display: none;
}

body.sidebar-compact .sidebar-brand::after {
    content: attr(data-initials);
    display: none;
}

body.sidebar-compact #sidebar-search-panel {
    display: none;
}

body.sidebar-compact #sidebar-menu {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    overflow: visible;
}

body.sidebar-compact #sidebar-menu a,
body.sidebar-compact #sidebar-menu .drop_down {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    position: relative;
}

body.sidebar-compact #sidebar-menu a span,
body.sidebar-compact #sidebar-menu .drop_down span,
body.sidebar-compact #sidebar-menu .drop_down .svg {
    display: none;
}

body.sidebar-compact #sidebar-menu .sidebar-menu-header {
    display: none;
}

body.sidebar-compact #sidebar-menu .sidebar-menu-item {
    position: relative;
}

body.sidebar-compact #sidebar-menu .chiled {
    position: absolute;
    left: calc(100% + 4px);
    top: 0;
    min-width: 12rem;
    margin: 0;
    padding: 0.5rem;
    padding-left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px var(--shadow-color);
    z-index: 50;
    display: none;
}

body.sidebar-compact #sidebar-menu .sidebar-menu-item.is-expanded > .chiled,
body.sidebar-compact #sidebar-menu .sidebar-menu-item.compact-flyout-open > .chiled {
    display: block;
}

body.sidebar-compact #sidebar-menu .chiled .tw-pl-11 {
    padding-left: 0.75rem;
}

body.sidebar-compact #sidebar-menu .chiled .tw-absolute {
    display: none;
}

body.sidebar-compact .sidebar-compact-tooltip {
    position: fixed;
    z-index: 9999;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    background: #1f2937;
    border-radius: 0.375rem;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

body.sidebar-compact .sidebar-compact-tooltip.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* ── MODERN (default enhanced) ── */
body.sidebar-modern #side-bar {
    width: 220px;
    max-width: 220px;
    background: var(--sidebar-bg);
    animation: sidebarModernSlideIn 0.45s ease;
}

@keyframes sidebarModernSlideIn {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

body.sidebar-modern #sidebar-menu a,
body.sidebar-modern #sidebar-menu .drop_down {
    border-radius: 0.75rem;
    margin-bottom: 0.125rem;
}

body.sidebar-modern #sidebar-menu a svg,
body.sidebar-modern #sidebar-menu a i,
body.sidebar-modern #sidebar-menu .drop_down svg:first-of-type,
body.sidebar-modern #sidebar-menu .drop_down i {
    background: transparent;
    border-radius: 0;
    padding: 0;
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    max-width: 1.25rem;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.sidebar-modern #sidebar-menu a,
body.sidebar-modern #sidebar-menu .drop_down,
body.sidebar-modern #sidebar-menu .chiled a {
    font-size: 1rem;
    line-height: 1.5;
}

body.sidebar-modern #sidebar-menu .theme-sidebar-active,
body.sidebar-modern #sidebar-menu .drop_down.theme-sidebar-active {
    background: var(--sidebar-active-bg);
    box-shadow: none;
}

body.sidebar-custom-logo-enabled.sidebar-modern .sidebar-brand .side-bar-heading,
body.sidebar-custom-logo-enabled.sidebar-custom .sidebar-brand .side-bar-heading {
    display: none;
}

body.sidebar-custom-logo-enabled.sidebar-modern .sidebar-brand,
body.sidebar-custom-logo-enabled.sidebar-custom .sidebar-brand {
    background: var(--sidebar-brand-bg);
    border-bottom: 1px solid var(--sidebar-brand-border);
}

/* ── CUSTOM (glass + neon) ── */
body.sidebar-custom #side-bar {
    width: 240px;
    max-width: 240px;
    background: var(--sidebar-bg);
    border-right: none;
    position: relative;
}

body.sidebar-custom #side-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-color), #a855f7, var(--accent-color));
    background-size: 100% 200%;
    animation: sidebarCustomBorder 4s linear infinite;
}

@keyframes sidebarCustomBorder {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 200%;
    }
}

body.sidebar-custom #sidebar-menu a,
body.sidebar-custom #sidebar-menu .drop_down {
    border-left: 2px solid transparent;
    transition: border-color var(--layout-transition), box-shadow var(--layout-transition);
}

body.sidebar-custom #sidebar-menu a:hover,
body.sidebar-custom #sidebar-menu .drop_down:hover {
    border-left-color: var(--accent-color);
    box-shadow: inset 4px 0 12px color-mix(in srgb, var(--accent-color) 15%, transparent);
}

body.sidebar-custom #sidebar-menu .theme-sidebar-active,
body.sidebar-custom #sidebar-menu .drop_down.theme-sidebar-active {
    border-left-color: var(--accent-color);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent-color) 35%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--accent-color) 8%, transparent);
    animation: sidebarCustomGlow 2s ease-in-out infinite alternate;
}

@keyframes sidebarCustomGlow {
    from {
        box-shadow: 0 0 8px color-mix(in srgb, var(--accent-color) 25%, transparent);
    }
    to {
        box-shadow: 0 0 16px color-mix(in srgb, var(--accent-color) 45%, transparent);
    }
}

body.sidebar-custom .sidebar-brand {
    background: var(--sidebar-brand-bg);
}

/* Mobile drawer — all layouts */
@media (max-width: 1023px) {
    body.sidebar-compact #side-bar,
    body.sidebar-classic #side-bar,
    body.sidebar-modern #side-bar,
    body.sidebar-custom #side-bar {
        width: 16rem;
        max-width: 85vw;
    }

    body.sidebar-compact #sidebar-search-panel {
        display: block;
    }

    body.sidebar-compact #sidebar-menu a span,
    body.sidebar-compact #sidebar-menu .drop_down span {
        display: inline;
    }

    body.sidebar-compact #sidebar-menu .chiled {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
    }
}

/* ── Mobile drawer + desktop collapse (shared) ── */
.small-view-side-active,
#side-bar.small-view-side-active,
aside.side-bar.small-view-side-active {
    display: flex !important;
    flex-direction: column;
    z-index: 1050;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 16rem;
    max-width: 85vw;
}

.overlay,
.sidebar-mobile-overlay {
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    z-index: 35;
}

.sidebar-mobile-overlay.is-active {
    display: block !important;
}

body.sidebar-open {
    overflow: hidden;
}

@media (min-width: 1024px) {
    body.sidebar-desktop-collapsed .side-bar,
    body.sidebar-desktop-collapsed #side-bar {
        display: none !important;
    }
}
