/* ══════════════════════════════════════════════════════
   Admin Sidebar – Light Dashboard Layout
   Sidebar sits below #mainNav, uses white/light theme
   ══════════════════════════════════════════════════════ */

:root {
    --sidebar-width: 200px;
    --sidebar-collapsed-width: 56px;
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --sidebar-text-hover: #1e293b;
    --sidebar-active-bg: rgba(17, 110, 203, 0.08);
    --sidebar-active-text: #116ecb;
    --sidebar-active-accent: #116ecb;
    --sidebar-border: #e9ecef;
    --sidebar-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --navbar-height: 49px;
}

/* ── Sidebar ───────────────────────────────────────── */
.admin-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: width var(--sidebar-transition), transform var(--sidebar-transition);
    overflow: visible;
    border-right: 1px solid var(--sidebar-border);
}

.admin-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* ── Nav Items ─────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 8px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-nav-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #b0b8c4;
    padding: 12px 10px 6px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.admin-sidebar.collapsed .sidebar-nav-label {
    opacity: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: color 0.18s ease, background 0.18s ease;
    margin-bottom: 2px;
}

.sidebar-nav-item:hover {
    color: var(--sidebar-text-hover);
    background: #f1f5f9;
}

.sidebar-nav-item.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-active-accent);
}

.sidebar-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.18s ease;
}

.sidebar-nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.sidebar-action-btn svg {
    fill: currentColor;
}

.sidebar-nav-item:hover .sidebar-nav-icon,
.sidebar-nav-item.active .sidebar-nav-icon {
    opacity: 1;
}

.sidebar-nav-text {
    opacity: 1;
    transition: opacity 0.15s ease, width 0.15s ease;
}

.admin-sidebar.collapsed .sidebar-nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ── Toggle Button ─────────────────────────────────── */
.sidebar-toggle {
    position: absolute;
    top: 12px;
    right: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--sidebar-border);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1031;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle:hover {
    background: var(--sidebar-active-accent);
    color: #fff;
    border-color: var(--sidebar-active-accent);
}

.sidebar-toggle i {
    font-size: 11px;
    transition: transform 0.25s ease;
}

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

/* ── Sidebar Footer (User) ─────────────────────────── */
.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 10px 8px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.18s ease;
    cursor: default;
}

.sidebar-user:hover {
    background: #f8fafc;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    background: linear-gradient(135deg, var(--sidebar-active-accent), #3b82f6);
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.admin-sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.sidebar-user-role {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-active-accent);
    line-height: 1;
    margin-bottom: 2px;
}

.sidebar-user-name {
    font-size: 0.78rem;
    color: #475569;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sidebar Footer Actions ────────────────────────── */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
}



.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.18s ease;
    flex: 1;
    cursor: pointer;
}

.sidebar-action-btn:hover {
    background: #f1f5f9;
    color: var(--sidebar-text-hover);
}

.sidebar-action-btn .sidebar-nav-icon,
.sidebar-action-btn .sidebar-nav-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-action-btn svg {
    flex-shrink: 0;
}

.sidebar-action-text {
    opacity: 1;
    transition: opacity 0.15s ease;
}

.admin-sidebar.collapsed .sidebar-action-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.admin-sidebar.collapsed .sidebar-action-btn {
    flex: unset;
}

/* ── Main Content ──────────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left var(--sidebar-transition);
}

.admin-sidebar.collapsed~.admin-main {
    margin-left: var(--sidebar-collapsed-width);
}

/* ══════════════════════════════════════════════════════
   Mobile Responsive
   ══════════════════════════════════════════════════════ */

/* ── Mobile Overlay ────────────────────────────────── */
.sidebar-overlay {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 1029;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        box-shadow: none;
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
    }

    /* Never show collapsed state on mobile */
    .admin-sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .admin-sidebar.collapsed .sidebar-nav-text,
    .admin-sidebar.collapsed .sidebar-nav-label,
    .admin-sidebar.collapsed .sidebar-user-info,
    .admin-sidebar.collapsed .sidebar-action-text {
        opacity: 1;
        width: auto;
        height: auto;
        pointer-events: auto;
    }




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

    .sidebar-toggle {
        display: none;
    }
}

@media (min-width: 992px) {
    .sidebar-overlay {
        display: none;
    }
}

/* ── Tooltip for collapsed sidebar (desktop) ──────── */
@media (min-width: 992px) {


    .admin-sidebar.collapsed .sidebar-nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e293b;
        color: #fff;
        padding: 4px 10px;
        border-radius: 6px;
        font-size: 0.72rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 1050;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .admin-sidebar.collapsed .sidebar-nav-item:hover::after {
        opacity: 1;
    }
}