/**
 * Sidebar transparent — ghost labels (no boxes, simple hover).
 * Desktop + mobile web.
 */

.sidebar {
    background: transparent !important;
    border-right: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

.sidebar-header,
.sidebar-footer {
    background: transparent !important;
    border: none !important;
}

[data-theme="glass"] .sidebar {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-right: none !important;
}

.sidebar-nav {
    gap: 2px;
    padding: 4px 10px 8px;
}

.sidebar-nav-item {
    border: none !important;
    border-left: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    padding: 7px 4px;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.sidebar-nav-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.52;
}

.sidebar-nav-item:hover,
.sidebar-nav-item:focus-visible {
    color: rgba(255, 255, 255, 0.98);
    background: transparent !important;
}

.sidebar-nav-item:hover svg,
.sidebar-nav-item:focus-visible svg {
    opacity: 0.82;
}

.sidebar-nav-item.is-active {
    color: rgba(255, 255, 255, 0.9);
    background: transparent !important;
    border-left-color: transparent !important;
}

.sidebar-nav-item.is-active svg {
    opacity: 0.72;
}

.sidebar-collapse-btn {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(255, 255, 255, 0.48);
}

.sidebar-collapse-btn:hover {
    color: rgba(255, 255, 255, 0.92);
    background: transparent !important;
    border-color: transparent !important;
}

.sidebar-content {
    margin: 0;
    padding: 4px 10px 10px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Drawer Conversas / Projetos — quase ghost (sem caixa) */
.sidebar-conversations-drawer:not([hidden]) {
    margin: 6px 8px 10px;
    padding: 8px 10px 12px;
    border-radius: 10px;
    background: rgba(10, 14, 22, 0.07) !important;
    backdrop-filter: blur(12px) saturate(130%);
    -webkit-backdrop-filter: blur(12px) saturate(130%);
    border: none;
    box-shadow: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.sidebar-content.sidebar-conversations-drawer:not([hidden]) {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar,
.sidebar-content.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar {
    width: 2px;
}

.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-track,
.sidebar-content.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb,
.sidebar-content.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb,
.sidebar-content.sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
}

.history-section-subtitle,
.dev-projects-title,
.dev-sidebar-section-head .dev-projects-title {
    color: rgba(255, 255, 255, 0.44);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    padding: 8px 4px 4px;
}

.dev-project-new-chat,
.dev-sidebar-section-head button {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.45);
}

.dev-project-new-chat:hover {
    color: rgba(255, 255, 255, 0.88);
}

.sidebar-content .dev-project-toggle {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.48);
    font-weight: 500;
    padding: 6px 4px;
}

.sidebar-content .dev-project-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-content .dev-project-branch {
    color: rgba(255, 255, 255, 0.28);
}

.sidebar-content .dev-project-group--others {
    border: none;
    background: transparent;
}

.sidebar-content .dev-project-section-label {
    color: rgba(255, 255, 255, 0.28);
    letter-spacing: 0.1em;
}

.sidebar-content .dev-project-conversations {
    padding: 0 4px 4px;
}

.sidebar-conversations-drawer .history-item,
.sidebar-conversations-drawer .dev-conv-item {
    --history-opacity: 0.85;
    --history-proximity: 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none !important;
    border-left: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    padding: 5px 4px;
    color: rgba(255, 255, 255, 0.72);
    opacity: calc(
        var(--history-opacity) +
        (1 - var(--history-opacity)) * var(--history-proximity)
    );
    transition:
        opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        color 0.28s ease,
        background 0.28s ease;
}

.sidebar-conversations-drawer .history-item:hover .history-item-actions,
.sidebar-conversations-drawer .history-item:focus-within .history-item-actions {
    opacity: 1;
    pointer-events: auto;
    background: rgba(12, 16, 24, 0.88);
    padding-left: 8px;
    box-shadow: -10px 0 14px rgba(12, 16, 24, 0.88);
}

.sidebar-conversations-drawer .history-section {
    margin-bottom: 6px;
}

.sidebar-conversations-drawer .history-section-subtitle {
    display: flex;
}

.sidebar-conversations-drawer .history-item-title,
.sidebar-conversations-drawer .dev-conv-item-title {
    color: inherit;
}

.sidebar-conversations-drawer .dev-conv-item {
    gap: 6px;
}

.sidebar-conversations-drawer .history-item:hover,
.sidebar-conversations-drawer .history-item:focus-within,
.sidebar-conversations-drawer .dev-conv-item:hover {
    opacity: 1 !important;
    color: rgba(255, 255, 255, 0.98);
    background: rgba(255, 255, 255, 0.06) !important;
    border-radius: 6px;
}

.sidebar-conversations-drawer .history-item.active,
.sidebar-conversations-drawer .dev-conv-item.is-active {
    opacity: 1 !important;
    color: rgba(255, 255, 255, 0.96);
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 6px;
    box-shadow: none !important;
    border-left-color: transparent !important;
}

.sidebar-conversations-drawer .dev-conv-item-dot {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.45);
    opacity: calc(0.35 + 0.65 * (var(--history-opacity) + (1 - var(--history-opacity)) * var(--history-proximity)));
    transition: opacity 0.42s ease, background 0.28s ease;
}

.sidebar-conversations-drawer .dev-conv-item:hover .dev-conv-item-dot,
.sidebar-conversations-drawer .dev-conv-item.is-active .dev-conv-item-dot {
    background: rgba(0, 217, 255, 0.75);
    opacity: 1;
}

.sidebar-conversations-drawer .history-item-meta {
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
}

.sidebar-conversations-drawer .history-item:hover .history-item-meta {
    color: rgba(255, 255, 255, 0.62);
}

.show-more-btn {
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.58) !important;
    padding: 8px 4px !important;
}

.show-more-btn:hover {
    color: rgba(255, 255, 255, 0.85) !important;
    background: transparent !important;
}

.sidebar-footer {
    padding: 12px 10px 14px;
}

.sidebar-footer-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 4px;
    border: none;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.48);
    font-size: 11px;
    font-weight: 400;
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
}

.sidebar-footer-link svg {
    width: 13px;
    height: 13px;
    opacity: 0.55;
    flex-shrink: 0;
}

.sidebar-footer-link:hover,
.sidebar-footer-link:focus-visible {
    color: rgba(255, 255, 255, 0.92);
}

.sidebar-footer-link:hover svg,
.sidebar-footer-link:focus-visible svg {
    opacity: 0.82;
}

.sidebar-footer-link--logout {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.42);
}

.sidebar-footer-link--logout:hover,
.sidebar-footer-link--logout:focus-visible {
    color: rgba(255, 160, 160, 0.78);
}

.sidebar-footer-link--update {
    color: rgba(0, 217, 255, 0.55);
    text-transform: none;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.sidebar-footer-link--update:hover {
    color: rgba(0, 217, 255, 0.92);
}

.sidebar-footer-link--update.pu-update-scope-others {
    color: rgba(251, 191, 36, 0.62);
}

.sidebar-nav .auto-prompt-item {
    border: none !important;
    border-left: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.62) !important;
    padding: 7px 4px !important;
}

.sidebar-nav .auto-prompt-item:hover {
    color: rgba(255, 255, 255, 0.98) !important;
    background: transparent !important;
}

[data-theme="light"] .sidebar-nav-item,
[data-theme="glass"] .sidebar-nav-item,
[data-theme="light"] .sidebar-footer-link,
[data-theme="glass"] .sidebar-footer-link {
    color: rgba(15, 23, 42, 0.52);
}

[data-theme="light"] .sidebar-nav-item:hover,
[data-theme="glass"] .sidebar-nav-item:hover,
[data-theme="light"] .sidebar-footer-link:hover,
[data-theme="glass"] .sidebar-footer-link:hover {
    color: rgba(15, 23, 42, 0.92);
}

[data-theme="light"] .sidebar-conversations-drawer:not([hidden]),
[data-theme="glass"] .sidebar-conversations-drawer:not([hidden]) {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none;
    box-shadow: none;
    scrollbar-color: rgba(15, 23, 42, 0.08) transparent;
}

[data-theme="light"] .sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb,
[data-theme="glass"] .sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb,
[data-theme="light"] .sidebar-content.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb,
[data-theme="glass"] .sidebar-content.sidebar-conversations-drawer:not([hidden])::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb,
[data-theme="glass"] .sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb,
[data-theme="light"] .sidebar-content.sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb,
[data-theme="glass"] .sidebar-content.sidebar-conversations-drawer:not([hidden]):hover::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.16);
}

[data-theme="light"] .sidebar-conversations-drawer .history-item,
[data-theme="glass"] .sidebar-conversations-drawer .history-item,
[data-theme="light"] .sidebar-conversations-drawer .dev-conv-item,
[data-theme="glass"] .sidebar-conversations-drawer .dev-conv-item {
    color: rgba(15, 23, 42, 0.62);
}

[data-theme="light"] .sidebar-conversations-drawer .history-item:hover,
[data-theme="glass"] .sidebar-conversations-drawer .history-item:hover,
[data-theme="light"] .sidebar-conversations-drawer .dev-conv-item:hover,
[data-theme="glass"] .sidebar-conversations-drawer .dev-conv-item:hover {
    color: rgba(15, 23, 42, 0.92);
}

/* Mobile — painel slide-in com ghost + frosted leve para legibilidade */
@media (max-width: 768px) {
    .sidebar {
        border-right: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .sidebar.mobile-visible {
        background: rgba(8, 12, 20, 0.72) !important;
        backdrop-filter: blur(28px) saturate(150%) !important;
        -webkit-backdrop-filter: blur(28px) saturate(150%) !important;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.28) !important;
    }

    .sidebar-header {
        padding: 14px 12px 6px;
    }

    .sidebar-nav {
        padding: 4px 12px 8px;
    }

    .sidebar-nav-item {
        padding: 9px 6px;
        font-size: 14px;
    }

    .sidebar-nav-item svg {
        width: 16px;
        height: 16px;
    }

    .sidebar-content {
        padding: 4px 8px 10px;
    }

    .sidebar-conversations-drawer:not([hidden]) {
        margin: 6px 6px 10px;
    }

    .sidebar-footer {
        padding: 10px 12px max(14px, env(safe-area-inset-bottom, 14px));
    }

    .sidebar-footer-link {
        padding: 9px 6px;
        font-size: 12px;
    }

    .mobile-sidebar-overlay.active {
        background: rgba(0, 0, 0, 0.42);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
}

/* Desktop-only */
@media (min-width: 769px) {
    /* /chat vazio (pré-enter): sidebar ghost por cima — não empurra o welcome */
    body[data-page-id="chat"]:has(.main-content.chat-empty) .main-content {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 110;
        transition: transform var(--transition-normal);
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar:not(.sidebar-collapsed) {
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        max-width: min(var(--sidebar-width), 92vw) !important;
        transform: translateX(0);
        pointer-events: auto;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar.sidebar-collapsed:not(.sidebar-collapsed--rail) {
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        max-width: min(var(--sidebar-width), 92vw) !important;
        transform: translateX(-100%);
        pointer-events: none;
        overflow: hidden;
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar.sidebar-collapsed.sidebar-collapsed--rail {
        position: fixed !important;
        width: var(--sidebar-rail-width) !important;
        min-width: var(--sidebar-rail-width) !important;
        max-width: var(--sidebar-rail-width) !important;
        transform: translateX(0);
        pointer-events: auto;
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .mobile-sidebar-overlay {
        display: none !important;
    }

    /* /chat vazio: sem botão recolher — fecha ao clicar fora */
    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar-collapse-btn {
        display: none !important;
    }

    /* /chat com conversa: tab minimal na borda direita da sidebar */
    body[data-page-id="chat"]:has(.main-content:not(.chat-empty)) .sidebar:not(.sidebar-collapsed) {
        position: relative;
        overflow: visible;
        z-index: 110;
    }

    body[data-page-id="chat"]:has(.main-content:not(.chat-empty)) .sidebar-header {
        position: static;
        padding-right: 10px;
    }

    body[data-page-id="chat"]:has(.main-content:not(.chat-empty)) .sidebar-collapse-btn {
        display: inline-flex !important;
        position: fixed;
        top: 12px;
        left: calc(var(--sidebar-width, 224px) - 2px);
        right: auto;
        width: 22px;
        height: 32px;
        padding: 0;
        border-radius: 0 10px 10px 0;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-left: none;
        background: rgba(10, 14, 22, 0.82);
        backdrop-filter: blur(16px) saturate(160%);
        -webkit-backdrop-filter: blur(16px) saturate(160%);
        color: rgba(255, 255, 255, 0.72);
        z-index: 125;
        box-shadow: 2px 0 18px rgba(0, 0, 0, 0.28);
        pointer-events: auto;
    }

    body[data-page-id="chat"]:has(.main-content:not(.chat-empty)) .sidebar-collapse-btn:hover {
        color: rgba(255, 255, 255, 0.92);
        background: rgba(12, 18, 28, 0.72);
        border-color: rgba(255, 255, 255, 0.14);
    }

    body[data-page-id="chat"]:has(.main-content:not(.chat-empty)) .sidebar-collapse-btn svg {
        width: 11px;
        height: 11px;
    }

    body[data-page-id="chat"]:has(.main-content.chat-empty) .sidebar-header {
        padding-top: 10px;
    }

    .sidebar.sidebar-collapsed.sidebar-collapsed--rail .sidebar-nav-item {
        padding: 8px 4px;
        justify-content: center;
    }

    .sidebar.sidebar-collapsed.sidebar-collapsed--rail .sidebar-footer-link {
        justify-content: center;
        padding: 8px 4px;
    }

    .sidebar.sidebar-collapsed.sidebar-collapsed--rail .sidebar-footer-link > span {
        display: none;
    }

    .sidebar.sidebar-collapsed.sidebar-collapsed--rail .sidebar-footer-nav {
        border-top: none;
        padding-top: 4px;
    }

    .sidebar.sidebar-compact:not(.sidebar-collapsed) {
        justify-content: flex-start;
    }

    .sidebar.sidebar-compact:not(.sidebar-collapsed) .sidebar-footer {
        margin-top: auto;
        padding-top: 8px;
    }
}
