/* ==========================================================================
   NEXADRIVE PARTNER CENTER
   SIDEBAR UNIFICADA — DESKTOP E MOBILE V1

   Um único HTML:
   includes/sidebar.php

   Desktop:
   sidebar fixa/aderente à esquerda.

   Mobile:
   o mesmo componente funciona como drawer pela direita.
   ========================================================================== */

/* ==========================================================================
   BASE COMPARTILHADA
   ========================================================================== */

html body aside.sidebar.partner-sidebar {
    position: relative;
    z-index: 50;

    display: flex;
    flex-direction: column;

    min-width: 0;
    margin: 0;
    padding: 20px 15px;

    color: #f8fafc;

    border: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.12);

    background:
        radial-gradient(
            circle at 15% 4%,
            rgba(37, 99, 235, 0.14),
            transparent 30%
        ),
        linear-gradient(
            180deg,
            #202b3a 0%,
            #182333 52%,
            #111b2a 100%
        );

    box-shadow:
        16px 0 42px rgba(2, 6, 23, 0.16);

    box-sizing: border-box;
}

html body .partner-sidebar::before,
html body .partner-sidebar::after {
    pointer-events: none;
}

html body .partner-sidebar-brand {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 12px;

    flex: 0 0 auto;

    margin: 0 0 22px;
    padding: 4px 4px 19px;

    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

html body .partner-sidebar-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;

    border: 1px solid rgba(125, 211, 252, 0.62);
    border-radius: 14px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #38bdf8,
            #2563eb 58%,
            #4f46e5
        );

    font-size: 13px;
    font-weight: 950;
    letter-spacing: -0.03em;

    box-shadow:
        0 13px 29px rgba(37, 99, 235, 0.29),
        inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

html body .partner-sidebar-brand strong {
    display: block;

    margin: 0 0 3px;

    color: #ffffff;

    font-size: 14px;
    font-weight: 950;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

html body .partner-sidebar-brand span {
    display: block;

    color: #8fa8ca;

    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
}

/* ==========================================================================
   NAVEGAÇÃO
   ========================================================================== */

html body .partner-sidebar-menu {
    display: block;

    flex: 1 1 auto;
    min-height: 0;

    margin: 0;
    padding: 0 2px 18px;

    overflow-x: hidden;
    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(96, 165, 250, 0.32)
        transparent;
}

html body .partner-sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

html body .partner-sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

html body .partner-sidebar-menu::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.30);
}

html body .partner-sidebar-label {
    margin: 18px 9px 8px;

    color: #6682a8;

    font-size: 9px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

html body .partner-sidebar-label:first-child {
    margin-top: 1px;
}

html body .partner-sidebar-menu a,
html body .partner-sidebar-menu a:visited {
    position: relative;

    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;

    min-width: 0;
    min-height: 44px;

    margin: 3px 0;
    padding: 6px 11px 6px 8px;

    overflow: hidden;

    border: 1px solid transparent;
    border-radius: 12px;

    color: #b9cae2;
    background: transparent;

    font-size: 11px;
    font-weight: 820;
    line-height: 1.15;
    text-decoration: none;

    transition:
        transform 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

html body .partner-sidebar-menu a::after {
    content: "";

    position: absolute;
    top: 9px;
    bottom: 9px;
    left: 0;

    width: 3px;

    border-radius: 999px;

    background: transparent;
}

html body .partner-sidebar-menu a:hover {
    transform: translateX(2px);

    color: #ffffff;

    border-color: rgba(96, 165, 250, 0.18);

    background:
        linear-gradient(
            135deg,
            rgba(30, 64, 175, 0.18),
            rgba(37, 99, 235, 0.08)
        );
}

html body .partner-sidebar-menu a.active {
    color: #ffffff;

    border-color: rgba(96, 165, 250, 0.38);

    background:
        radial-gradient(
            circle at 88% 20%,
            rgba(56, 189, 248, 0.14),
            transparent 42%
        ),
        linear-gradient(
            135deg,
            rgba(37, 99, 235, 0.31),
            rgba(30, 64, 175, 0.18)
        );

    box-shadow:
        0 11px 24px rgba(2, 6, 23, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

html body .partner-sidebar-menu a.active::after {
    background:
        linear-gradient(
            180deg,
            #38bdf8,
            #2563eb
        );

    box-shadow:
        0 0 12px rgba(56, 189, 248, 0.80);
}

html body .partner-sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;

    color: #8fa9cf;
    background: rgba(7, 17, 31, 0.28);

    font-size: 12px;
    font-weight: 950;
    line-height: 1;

    transition:
        color 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

html body .partner-sidebar-menu a:hover .partner-sidebar-icon,
html body .partner-sidebar-menu a.active .partner-sidebar-icon {
    color: #ffffff;

    border-color: rgba(125, 211, 252, 0.45);

    background:
        linear-gradient(
            135deg,
            rgba(56, 189, 248, 0.62),
            rgba(37, 99, 235, 0.72)
        );

    box-shadow:
        0 8px 18px rgba(37, 99, 235, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   RODAPÉ / SAIR
   ========================================================================== */

html body .partner-sidebar-footer {
    flex: 0 0 auto;

    margin: auto 0 0;
    padding: 16px 2px 1px;

    border-top: 1px solid rgba(148, 163, 184, 0.13);
}

html body .partner-sidebar-footer form {
    width: 100%;
    margin: 0;
}

html body .partner-sidebar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 42px;
    padding: 9px 12px;

    border: 1px solid rgba(251, 113, 133, 0.25);
    border-radius: 11px;

    color: #fda4af;

    background:
        linear-gradient(
            135deg,
            rgba(127, 29, 29, 0.21),
            rgba(76, 5, 25, 0.12)
        );

    cursor: pointer;

    font-size: 10px;
    font-weight: 950;

    transition:
        transform 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

html body .partner-sidebar-logout:hover {
    transform: translateY(-1px);

    color: #ffffff;
    border-color: rgba(251, 113, 133, 0.55);

    background:
        linear-gradient(
            135deg,
            #e11d48,
            #be123c
        );

    box-shadow:
        0 11px 24px rgba(190, 18, 60, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

/* ==========================================================================
   BOTÃO MOBILE
   ========================================================================== */

html body .partner-mobile-menu-button {
    display: none;
}

/* ==========================================================================
   DESKTOP
   ========================================================================== */

@media (min-width: 821px) {
    html body aside.sidebar.partner-sidebar {
        position: sticky;
        top: 0;

        width: 250px;
        min-width: 250px;
        height: 100vh;
        max-height: 100vh;

        transform: none;

        overflow: hidden;
    }
}

/* ==========================================================================
   MOBILE — MESMA SIDEBAR COMO DRAWER
   ========================================================================== */

@media (max-width: 820px) {
    html body .partner-mobile-menu-button {
        position: fixed;
        z-index: 1002;
        top: 14px;
        right: 14px;
        left: auto;

        display: inline-flex;
        align-items: center;
        justify-content: center;

        width: 48px;
        height: 48px;
        margin: 0;
        padding: 0;

        border: 1px solid rgba(125, 211, 252, 0.55);
        border-radius: 14px;

        color: transparent;

        background:
            radial-gradient(
                circle at 30% 20%,
                rgba(255, 255, 255, 0.13),
                transparent 38%
            ),
            linear-gradient(
                135deg,
                #38bdf8,
                #2563eb 58%,
                #4f46e5
            );

        box-shadow:
            0 13px 28px rgba(2, 6, 23, 0.30),
            0 0 20px rgba(37, 99, 235, 0.16),
            inset 0 1px 0 rgba(255, 255, 255, 0.20);

        cursor: pointer;

        transform: none;
    }

    html body .partner-mobile-menu-button span,
    html body .partner-mobile-menu-button span::before,
    html body .partner-mobile-menu-button span::after {
        position: absolute;

        display: block;

        width: 20px;
        height: 2px;

        border-radius: 999px;

        background: #ffffff;

        transition:
            transform 0.20s ease,
            top 0.20s ease,
            opacity 0.16s ease;
    }

    html body .partner-mobile-menu-button span {
        top: 23px;
        left: 14px;
    }

    html body .partner-mobile-menu-button span::before,
    html body .partner-mobile-menu-button span::after {
        content: "";
        left: 0;
    }

    html body .partner-mobile-menu-button span::before {
        top: -7px;
    }

    html body .partner-mobile-menu-button span::after {
        top: 7px;
    }

    html body.partner-mobile-menu-open
    .partner-mobile-menu-button span {
        background: transparent;
    }

    html body.partner-mobile-menu-open
    .partner-mobile-menu-button span::before {
        top: 0;
        transform: rotate(45deg);
    }

    html body.partner-mobile-menu-open
    .partner-mobile-menu-button span::after {
        top: 0;
        transform: rotate(-45deg);
    }

    /* Backdrop criado no próprio body */

    html body.partner-mobile-menu-open::before {
        content: "";

        position: fixed;
        z-index: 998;
        inset: 0;

        display: block;

        background:
            rgba(2, 6, 23, 0.72);

        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    html body aside.sidebar.partner-sidebar {
        position: fixed;
        z-index: 1000;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;

        display: flex;

        width: min(88vw, 340px);
        min-width: 0;
        max-width: 340px;
        height: 100dvh;
        max-height: 100dvh;

        padding:
            max(18px, env(safe-area-inset-top))
            15px
            max(16px, env(safe-area-inset-bottom));

        border-right: 0;
        border-left: 1px solid rgba(125, 211, 252, 0.20);

        transform: translateX(110%);

        overflow: hidden;
        visibility: hidden;
        pointer-events: none;

        box-shadow:
            -24px 0 56px rgba(2, 6, 23, 0.42);

        transition:
            transform 0.26s cubic-bezier(.22, .61, .36, 1),
            visibility 0.26s ease;
    }

    html body.partner-mobile-menu-open
    aside.sidebar.partner-sidebar {
        transform: translateX(0);

        visibility: visible;
        pointer-events: auto;
    }

    html body.partner-mobile-menu-open {
        overflow: hidden;
        touch-action: none;
    }

    html body.partner-mobile-menu-open
    .partner-sidebar-menu {
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    html body .partner-sidebar-brand {
        padding-right: 48px;
    }

    html body .partner-sidebar-menu a {
        min-height: 46px;
    }
}

/* Celulares pequenos */

@media (max-width: 390px) {
    html body aside.sidebar.partner-sidebar {
        width: min(92vw, 326px);
    }

    html body .partner-sidebar-brand {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    html body .partner-sidebar-mark {
        width: 42px;
        height: 42px;
    }
}

/* END SIDEBAR UNIFICADA — DESKTOP E MOBILE V1 */

/* ==========================================================================
   SIDEBAR UNIFICADA — CORES PREMIUM NO MOBILE V2

   No mobile, altera somente posição, largura e animação.
   O tema visual permanece igual ao desktop.
   ========================================================================== */

@media (max-width: 820px) {

    /* Fundo premium idêntico ao desktop */

    html body aside.sidebar.partner-sidebar,
    html body.partner-mobile-menu-open aside.sidebar.partner-sidebar {
        color: #f8fafc !important;

        border: 0 !important;
        border-left: 1px solid rgba(125, 211, 252, 0.22) !important;

        background:
            radial-gradient(
                circle at 14% 4%,
                rgba(37, 99, 235, 0.18),
                transparent 31%
            ),
            radial-gradient(
                circle at 92% 42%,
                rgba(79, 70, 229, 0.09),
                transparent 35%
            ),
            linear-gradient(
                180deg,
                #202b3a 0%,
                #192536 48%,
                #111c2c 100%
            ) !important;

        background-color: #192536 !important;

        box-shadow:
            -24px 0 58px rgba(2, 6, 23, 0.48),
            inset 1px 0 0 rgba(255, 255, 255, 0.025) !important;
    }

    /* Marca NexaDrive */

    html body .partner-sidebar-mark,
    html body.partner-mobile-menu-open .partner-sidebar-mark {
        color: #ffffff !important;

        border-color: rgba(125, 211, 252, 0.66) !important;

        background:
            linear-gradient(
                135deg,
                #38bdf8,
                #2563eb 58%,
                #4f46e5
            ) !important;

        box-shadow:
            0 13px 29px rgba(37, 99, 235, 0.29),
            inset 0 1px 0 rgba(255, 255, 255, 0.20) !important;
    }

    html body .partner-sidebar-brand strong,
    html body.partner-mobile-menu-open .partner-sidebar-brand strong {
        color: #ffffff !important;
    }

    html body .partner-sidebar-brand span,
    html body.partner-mobile-menu-open .partner-sidebar-brand span {
        color: #8fa8ca !important;
    }

    /* Labels das seções */

    html body .partner-sidebar-label,
    html body.partner-mobile-menu-open .partner-sidebar-label {
        color: #7592ba !important;
    }

    html body .partner-sidebar-label:nth-of-type(1),
    html body.partner-mobile-menu-open
    .partner-sidebar-label:nth-of-type(1) {
        color: #60a5fa !important;
    }

    html body .partner-sidebar-label:nth-of-type(2),
    html body.partner-mobile-menu-open
    .partner-sidebar-label:nth-of-type(2) {
        color: #fbbf24 !important;
    }

    html body .partner-sidebar-label:nth-of-type(3),
    html body.partner-mobile-menu-open
    .partner-sidebar-label:nth-of-type(3) {
        color: #c084fc !important;
    }

    /* Links base */

    html body .partner-sidebar-menu a,
    html body .partner-sidebar-menu a:visited,
    html body.partner-mobile-menu-open .partner-sidebar-menu a,
    html body.partner-mobile-menu-open .partner-sidebar-menu a:visited {
        color: #c6d4e8 !important;

        border-color: transparent !important;

        background: transparent !important;

        box-shadow: none !important;
    }

    html body .partner-sidebar-menu a:hover,
    html body.partner-mobile-menu-open .partner-sidebar-menu a:hover {
        color: #ffffff !important;

        border-color: rgba(96, 165, 250, 0.20) !important;

        background:
            linear-gradient(
                135deg,
                rgba(30, 64, 175, 0.20),
                rgba(37, 99, 235, 0.09)
            ) !important;
    }

    /* Item ativo idêntico ao desktop */

    html body .partner-sidebar-menu a.active,
    html body.partner-mobile-menu-open
    .partner-sidebar-menu a.active {
        color: #ffffff !important;

        border-color: rgba(96, 165, 250, 0.42) !important;

        background:
            radial-gradient(
                circle at 88% 20%,
                rgba(56, 189, 248, 0.18),
                transparent 42%
            ),
            linear-gradient(
                135deg,
                #2794ed,
                #2563eb 57%,
                #6548e8
            ) !important;

        box-shadow:
            0 13px 28px rgba(37, 99, 235, 0.29),
            inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    }

    html body .partner-sidebar-menu a.active::after,
    html body.partner-mobile-menu-open
    .partner-sidebar-menu a.active::after {
        background:
            linear-gradient(
                180deg,
                #7dd3fc,
                #38bdf8
            ) !important;

        box-shadow:
            0 0 13px rgba(56, 189, 248, 0.90) !important;
    }

    /* Ícones base */

    html body .partner-sidebar-icon,
    html body.partner-mobile-menu-open .partner-sidebar-icon {
        color: #8fa9cf !important;

        border-color: rgba(148, 163, 184, 0.18) !important;

        background: rgba(7, 17, 31, 0.30) !important;

        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.025) !important;
    }

    /*
     * Cores individuais dos ícones.
     * A ordem corresponde ao includes/sidebar.php.
     */

    html body .partner-sidebar-menu a:nth-of-type(1)
    .partner-sidebar-icon {
        color: #60a5fa !important;
        border-color: rgba(96, 165, 250, 0.34) !important;
        background: rgba(30, 64, 175, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(2)
    .partner-sidebar-icon {
        color: #34d399 !important;
        border-color: rgba(52, 211, 153, 0.34) !important;
        background: rgba(6, 95, 70, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(3)
    .partner-sidebar-icon {
        color: #22d3ee !important;
        border-color: rgba(34, 211, 238, 0.34) !important;
        background: rgba(14, 116, 144, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(4)
    .partner-sidebar-icon {
        color: #a78bfa !important;
        border-color: rgba(167, 139, 250, 0.34) !important;
        background: rgba(91, 33, 182, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(5)
    .partner-sidebar-icon {
        color: #fb923c !important;
        border-color: rgba(251, 146, 60, 0.34) !important;
        background: rgba(154, 52, 18, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(6)
    .partner-sidebar-icon {
        color: #fb7185 !important;
        border-color: rgba(251, 113, 133, 0.34) !important;
        background: rgba(159, 18, 57, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(7)
    .partner-sidebar-icon {
        color: #2dd4bf !important;
        border-color: rgba(45, 212, 191, 0.34) !important;
        background: rgba(15, 118, 110, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(8)
    .partner-sidebar-icon {
        color: #fbbf24 !important;
        border-color: rgba(251, 191, 36, 0.34) !important;
        background: rgba(146, 64, 14, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(9)
    .partner-sidebar-icon {
        color: #38bdf8 !important;
        border-color: rgba(56, 189, 248, 0.34) !important;
        background: rgba(3, 105, 161, 0.22) !important;
    }

    html body .partner-sidebar-menu a:nth-of-type(10)
    .partner-sidebar-icon {
        color: #c084fc !important;
        border-color: rgba(192, 132, 252, 0.34) !important;
        background: rgba(107, 33, 168, 0.22) !important;
    }

    /* Ícone do item ativo */

    html body .partner-sidebar-menu a.active
    .partner-sidebar-icon,
    html body.partner-mobile-menu-open
    .partner-sidebar-menu a.active
    .partner-sidebar-icon {
        color: #ffffff !important;

        border-color: rgba(186, 230, 253, 0.62) !important;

        background:
            linear-gradient(
                135deg,
                rgba(56, 189, 248, 0.92),
                rgba(37, 99, 235, 0.94)
            ) !important;

        box-shadow:
            0 9px 20px rgba(37, 99, 235, 0.26),
            inset 0 1px 0 rgba(255, 255, 255, 0.20) !important;
    }

    /* Rodapé e botão Sair iguais ao desktop */

    html body .partner-sidebar-footer,
    html body.partner-mobile-menu-open .partner-sidebar-footer {
        border-top-color: rgba(148, 163, 184, 0.14) !important;
    }

    html body .partner-sidebar-logout,
    html body.partner-mobile-menu-open .partner-sidebar-logout {
        color: #ffffff !important;

        border-color: rgba(125, 211, 252, 0.48) !important;

        background:
            linear-gradient(
                135deg,
                #38bdf8,
                #2563eb 56%,
                #6548e8
            ) !important;

        box-shadow:
            0 12px 27px rgba(37, 99, 235, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.17) !important;
    }

    /* Botão flutuante */

    html body .partner-mobile-menu-button {
        border-color: rgba(125, 211, 252, 0.62) !important;

        background:
            radial-gradient(
                circle at 30% 20%,
                rgba(255, 255, 255, 0.14),
                transparent 38%
            ),
            linear-gradient(
                135deg,
                #38bdf8,
                #2563eb 58%,
                #4f46e5
            ) !important;

        box-shadow:
            0 13px 28px rgba(2, 6, 23, 0.33),
            0 0 20px rgba(37, 99, 235, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.20) !important;
    }
}

/* END SIDEBAR UNIFICADA — CORES PREMIUM NO MOBILE V2 */
