/**
 * Sidebar PO UI v2 — design raffiné
 * Variables : --po-green, --po-green-light, --po-green-soft, --po-green-border (head)
 */

body.aside-v2-theme {
    --po-aside-w: 280px;
    --po-aside-fs: var(--po-layout-fs, 0.9375rem);
    --po-aside-fs-sm: var(--po-layout-fs-sm, 0.875rem);
    --po-aside-fs-xs: var(--po-layout-fs-xs, 0.8125rem);
    --po-aside-accent: var(--po-green, #2563eb);
    --po-aside-accent-light: var(--po-green-light, #eff6ff);
    --po-aside-accent-soft: var(--po-green-soft, #f8fafc);
    --po-aside-accent-border: var(--po-green-border, #bfdbfe);
    --po-aside-text: var(--po-layout-text, #1a202c);
    --po-aside-muted: var(--po-layout-muted, #718096);
    --po-aside-surface: #ffffff;
    --po-aside-rail: #f1f5f9;
}

/* ── Reset Metronic sur la sidebar v2 ── */
body.aside-v2-theme #kt_aside.po-aside-v2 {
    width: var(--po-aside-w) !important;
    background: var(--po-aside-surface) !important;
    border-right: 1px solid #e8edf3 !important;
    box-shadow: none !important;
}

body.aside-v2-theme #kt_aside.po-aside-v2 .brand,
body.aside-v2-theme #kt_aside.po-aside-v2 > .aside-menu-wrapper {
    display: none !important;
}

@media (min-width: 992px) {
    body.aside-v2-theme.aside-fixed .wrapper {
        padding-left: var(--po-aside-w) !important;
        transition: padding-left 0.25s ease;
    }

    body.aside-v2-theme.aside-minimize .wrapper {
        padding-left: 76px !important;
    }

    body.aside-v2-theme.aside-minimize #kt_aside.po-aside-v2 {
        width: 76px !important;
    }
}

/* ── Layout interne ── */
.po-aside-v2__shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.85rem 0.85rem 1rem;
    position: relative;
}

/* ── Toggle ── */
.po-aside-v2__toggle {
    position: absolute;
    top: 1.5rem;
    right: -13px;
    width: 26px;
    height: 26px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--po-aside-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    padding: 0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease, background 0.2s ease;
}

.po-aside-v2__toggle:hover {
    filter: brightness(1.06);
}

body.aside-v2-theme.aside-minimize .po-aside-v2__toggle svg {
    transform: rotate(180deg);
}

/* ── En-tête ── */
.po-aside-v2__head {
    position: relative;
    padding: 0 0.15rem 0.45rem;
    margin-bottom: 0.1rem;
    flex-shrink: 0;
}

.po-aside-v2__head-card {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e8edf3;
    border-radius: 16px;
    padding: 1rem 0.95rem 0.9rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.po-aside-v2__head-card::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 52px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--po-aside-accent) 10%, transparent) 0%, transparent 72%);
    pointer-events: none;
}

.po-aside-v2__identity {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.po-aside-v2__logo {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid #e8edf3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 5px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.po-aside-v2__logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.po-aside-v2__identity-text {
    min-width: 0;
}

.po-aside-v2__identity-text strong {
    display: block;
    font-size: var(--po-aside-fs-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--po-aside-text);
    line-height: 1.35;
    word-break: break-word;
}

.po-aside-v2__identity-text em {
    display: block;
    font-style: normal;
    font-size: var(--po-aside-fs-sm);
    color: var(--po-aside-muted);
    margin-top: 2px;
}

.po-aside-v2__head-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: var(--po-aside-accent-light);
    color: var(--po-aside-accent);
    font-size: var(--po-aside-fs-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.po-aside-v2__head-pill i {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* ── Zone scroll ── */
.po-aside-v2__scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 -0.15rem;
    padding: 0 0.15rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.po-aside-v2__scroll::-webkit-scrollbar {
    width: 4px;
}

.po-aside-v2__scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ── Liste principale ── */
.po-aside-v2__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.po-aside-v2__list > .po-aside-v2__node {
    margin-bottom: 0.2rem;
}

/* ── Lien niveau 1 ── */
.po-aside-v2__row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none !important;
    color: var(--po-aside-text) !important;
    font-size: var(--po-aside-fs);
    font-weight: 500;
    line-height: 1.4;
    background: transparent;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.po-aside-v2__row:hover {
    background: #f8fafc;
    color: var(--po-aside-text) !important;
}

.po-aside-v2__row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 0.875rem;
    background: transparent;
    transition: background 0.18s ease, color 0.18s ease;
}

.po-aside-v2__row-label {
    flex: 1;
    min-width: 0;
}

.po-aside-v2__row-caret {
    font-size: 0.7rem;
    color: #cbd5e1;
    transition: transform 0.22s ease, color 0.18s ease;
}

.po-aside-v2__node.is-open > .po-aside-v2__row .po-aside-v2__row-caret {
    transform: rotate(180deg);
    color: var(--po-aside-accent);
}

/* Actif — niveau 1 */
.po-aside-v2__row.is-active,
.po-aside-v2__row.is-branch {
    background: var(--po-aside-accent-light);
    border-color: var(--po-aside-accent-border);
    box-shadow: 0 3px 12px color-mix(in srgb, var(--po-aside-accent) 10%, transparent);
    color: var(--po-aside-accent) !important;
    font-weight: 600;
    font-size: var(--po-aside-fs);
}

.po-aside-v2__row.is-active .po-aside-v2__row-icon,
.po-aside-v2__row.is-branch .po-aside-v2__row-icon {
    background: color-mix(in srgb, var(--po-aside-accent) 14%, white);
    color: var(--po-aside-accent);
}

/* ── Sous-menu ── */
.po-aside-v2__children {
    list-style: none;
    margin: 0.15rem 0 0.4rem 0;
    padding: 0.35rem 0 0.35rem 1.15rem;
    border-left: 2px solid var(--po-aside-rail);
    margin-left: 1.25rem;
    display: none;
}

.po-aside-v2__node.is-open > .po-aside-v2__children {
    display: block;
    animation: poAsideSubIn 0.22s ease;
}

@keyframes poAsideSubIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.po-aside-v2__child {
    margin-bottom: 0.12rem;
}

.po-aside-v2__child-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.65rem;
    border-radius: 9px;
    text-decoration: none !important;
    color: var(--po-aside-muted) !important;
    font-size: var(--po-aside-fs-sm);
    font-weight: 500;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.po-aside-v2__child-link:hover {
    background: #f8fafc;
    color: var(--po-aside-text) !important;
}

.po-aside-v2__child-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}

.po-aside-v2__child-link.is-active {
    background: var(--po-aside-accent-light);
    border-color: var(--po-aside-accent-border);
    color: var(--po-aside-accent) !important;
    font-weight: 600;
}

.po-aside-v2__child-link.is-active .po-aside-v2__child-dot {
    background: var(--po-aside-accent);
    transform: scale(1.25);
}

/* Sous-niveaux imbriqués */
.po-aside-v2__children .po-aside-v2__children {
    margin-left: 0.75rem;
    padding-left: 0.85rem;
}

/* ── Mode réduit (desktop uniquement) ── */
@media (min-width: 992px) {
body.aside-v2-theme.aside-minimize .po-aside-v2__shell {
    padding: 0.85rem 0.5rem;
}

body.aside-v2-theme.aside-minimize .po-aside-v2__head-card,
body.aside-v2-theme.aside-minimize .po-aside-v2__identity-text,
body.aside-v2-theme.aside-minimize .po-aside-v2__head-pill,
body.aside-v2-theme.aside-minimize .po-aside-v2__row-label,
body.aside-v2-theme.aside-minimize .po-aside-v2__row-caret,
body.aside-v2-theme.aside-minimize .po-aside-v2__children {
    display: none !important;
}

body.aside-v2-theme.aside-minimize .po-aside-v2__identity {
    justify-content: center;
}

body.aside-v2-theme.aside-minimize .po-aside-v2__logo {
    width: 40px;
    height: 40px;
}

body.aside-v2-theme.aside-minimize .po-aside-v2__row {
    justify-content: center;
    padding: 0.55rem;
}

body.aside-v2-theme.aside-minimize .po-aside-v2__row-icon {
    margin: 0;
}
}

/* ── Mobile (< 992px) — menu latéral off-canvas Metronic ── */
@media (max-width: 991.98px) {
    body.aside-v2-theme.aside-fixed .wrapper,
    body.aside-v2-theme.aside-minimize .wrapper {
        padding-left: 0 !important;
    }

    body.aside-v2-theme #kt_aside.po-aside-v2,
    body.aside-v2-theme.aside-minimize #kt_aside.po-aside-v2 {
        width: 275px !important;
    }

    body.aside-v2-theme .po-aside-v2__toggle {
        display: none !important;
    }
}
