.left-panel {
    display: flex;
    flex-direction: column;
    /* background: var(--bg-secondary); */
    border-right: 1px solid var(--border);
    width: calc(var(--hub-sidebar-width) + var(--sidebar-width));
    font-family: "Quantico", sans-serif;
    transition: width 0.3s ease, opacity 0.25s ease, border-width 0.3s ease;
    overflow: hidden;
    flex-shrink: 1;
}

.left-panel.theme-modern {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 245, 255, 0.7));
}


.theme-dark-unicorn .left-panel {
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--unicorn-color, #9333ea) 85%, black),
            color-mix(in srgb, var(--unicorn-color, #9333ea) 8%, black));
}


.theme-unicorn .left-panel {
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--unicorn-color, #9333ea) 85%, black),
            color-mix(in srgb, var(--unicorn-color, #9333ea) 60%, black));
}

.left-panel-header {
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}


.logo-box {
    height: 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    align-items: baseline;
    font-family: "Iceland", sans-serif;
    letter-spacing: 1px;
}

.logo-k {
    color: white;
    font-size: 2.2rem;
    font-weight: 400;
}

.logo-yst {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.8rem;
    font-weight: 400;
    margin-left: -2px;
}

.server-selector-wrapper {
    flex: 1;
    position: relative;
}

.api-docs-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    cursor: pointer;
    padding: 8px 10px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
    transition: all 0.2s;
    flex-shrink: 0;
}

.api-docs-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.server-selector-btn {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.server-selector-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.server-selector-arrow {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
}



.server-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.server-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background 0.15s;
}

.server-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.server-dropdown-item.active {
    background: rgba(51, 122, 234, 0.15);
}

.server-dropdown-item.manage {
    flex-direction: row;
    color: var(--accent);
    font-weight: 500;
}

.server-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.server-item-host {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.server-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

.sidebar-tabs {
    display: flex;
    padding: 0 8px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}


.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.sidebar-tab:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.03);
}

.sidebar-tab.active {
    border-bottom-color: #ffffff;
}

.sidebar-tab.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}



.left-panel-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.lib-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border);
}

.theme-unicorn .lib-sidebar {
    border-left-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar Specifics from app.css */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.new-doc-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 16px;
    transition: background 0.2s;
}

.new-doc-btn:hover {
    background: var(--accent-hover);
}

.doc-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ============================================
   EXPANDED VIEW - Visão expandida
   ============================================ */

.left-panel.collapsed {
    width: 0;
    opacity: 0;
    border-width: 0;
}


/* ============================================
   EXPANDED VIEW - Visão expandida
   ============================================ */

.left-panel.collapsed {
    width: 0;
    opacity: 0;
    border-width: 0;
}

/* Toolbar no topo do main-content */
.main-content-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 3px 3px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

/* Botão da toolbar */
.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.05);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   MOBILE HAMBURGER BUTTON
   ============================================ */

.mobile-menu-btn {
    display: none;
}

.mobile-sidebar-close {
    display: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .left-panel {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 2000;
        width: calc(var(--hub-sidebar-width) + var(--sidebar-width));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        opacity: 1;
        background: var(--bg-secondary);
    }

    /* Show sidebar when toggled via mobile-open class */
    .left-panel.mobile-open {
        transform: translateX(0);
    }

    /* Override collapsed state on mobile — collapsed hides it fully */
    .left-panel.collapsed {
        transform: translateX(-100%);
        width: calc(var(--hub-sidebar-width) + var(--sidebar-width));
        opacity: 1;
    }

    /* Overlay behind sidebar when open */
    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
    }

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

    /* Show hamburger button on mobile */
    .mobile-menu-btn {
        display: flex;
    }

    /* Show close button inside sidebar on mobile */
    .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 10;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(0, 0, 0, 0.3);
        color: rgba(255, 255, 255, 0.8);
        cursor: pointer;
        transition: all 0.2s;
    }

    .mobile-sidebar-close:hover {
        background: rgba(0, 0, 0, 0.5);
        color: white;
    }

    /* Toolbar adjustments */
    .main-content-toolbar {
        justify-content: space-between;
    }

    /* Hide the expand/collapse button on mobile (hamburger replaces it) */
    .toolbar-btn.desktop-only {
        display: none;
    }

    /* Hide users panel on mobile */
    .users-panel {
        display: none;
    }
}
