/* ===== SIDEBAR NAVIGATION STYLES ===== */
/* Inspirado no SB Admin 2 */

:root {
    --sidebar-width: 250px;
    --sidebar-bg: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    --sidebar-text: #ffffff;
    --sidebar-text-active: #fff;
    --sidebar-divider: rgba(255, 255, 255, 0.3);
    --topbar-height: 60px;
}

/* Sidebar Container */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    transition: width 0.3s ease;
}

/* Sidebar Brand/Logo */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px;
    height: 80px;
    gap: 12px;
    border-bottom: 1px solid var(--sidebar-divider);
}

.sidebar-brand img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

/* Sidebar Divider */
.sidebar-divider {
    border-top: 1px solid var(--sidebar-divider);
    margin: 10px 20px;
}

/* Sidebar Heading */
.sidebar-heading {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.13rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 20px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-nav-item {
    padding: 0 15px;
    margin-bottom: 5px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-active);
}

.sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sidebar-text-active);
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* Sidebar User Info */
.sidebar-user {
    padding: 15px 20px;
    border-top: 1px solid var(--sidebar-divider);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.75rem;
}

.sidebar-logout {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Botão Editar Perfil */
.sidebar-edit-profile {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.sidebar-edit-profile:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #667eea;
}

/* Sidebar Delete Account Button */
.sidebar-delete-account {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 40px);
    margin: 0 20px 15px 20px;
    padding: 10px 15px;
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #ff6b7a;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-delete-account:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff8a97;
}

.sidebar-delete-account i {
    font-size: 0.85rem;
}

/* Sidebar Sub-items (indented) */
.sidebar-nav-item.sidebar-subitem {
    padding-left: 30px;
}

.sidebar-subitem .sidebar-nav-link {
    font-size: 0.85rem;
    padding: 10px 15px;
    opacity: 0.9;
}

.sidebar-subitem .sidebar-nav-link i {
    font-size: 0.9rem;
}

/* ===== SIDEBAR DROPDOWN ===== */
.sidebar-dropdown {
    position: relative;
}

.sidebar-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-dropdown.open .sidebar-dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-dropdown-menu {
    display: none;
    padding-left: 15px;
    margin-top: 5px;
}

.sidebar-dropdown.open .sidebar-dropdown-menu {
    display: block;
}

.sidebar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-dropdown-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.sidebar-dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

/* Main Content Wrapper with Sidebar */
#content-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary, #f8f9fc);
    display: flex;
    flex-direction: column;
}

/* Top Bar */
#topbar {
    height: var(--topbar-height);
    background: white;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #5a5c69;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Theme Toggle in Topbar */
.topbar-theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #f8f9fc;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #5a5c69;
}

/* Main Content Area */
#main-content {
    flex: 1;
    padding: 25px;
}

/* Hide old header when sidebar is active */
body.sidebar-layout #dashboard-header {
    display: none !important;
}

/* Adjust project manager for sidebar layout */
body.sidebar-layout #project-manager {
    padding: 0;
}

body.sidebar-layout .project-header {
    margin-bottom: 25px;
}

/* Dashboard nav - abas de categorias agora visíveis quando dashboard ativo */
/* body.sidebar-layout #dashboard-nav - removido pois agora abas aparecem no dashboard */

/* Auth container should ignore sidebar layout and take full screen */
body.sidebar-layout #auth-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    z-index: 1200;
}

/* When auth is visible, remove content-wrapper margin */
body.sidebar-layout #main-content:has(#auth-container:not([style*="display: none"])) {
    padding: 0;
}

/* Categories Nav in Sidebar */
.sidebar-categories {
    padding: 0 15px;
}

.sidebar-category-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.sidebar-category-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-active);
}

.sidebar-category-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sidebar-text-active);
}

.sidebar-category-link i {
    width: 18px;
    text-align: center;
    opacity: 0.8;
}

/* Responsive - Hide sidebar on mobile */
@media (max-width: 768px) {
    #sidebar {
        width: 0;
        overflow: hidden;
    }

    #content-wrapper {
        margin-left: 0;
    }

    body.sidebar-layout #dashboard-header {
        display: flex !important;
    }
}

/* Toggle Button for Mobile */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #5a5c69;
    cursor: pointer;
    padding: 10px;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    #sidebar.show {
        width: var(--sidebar-width);
    }
}

/* ===== DARK THEME STYLES FOR SIDEBAR LAYOUT ===== */
[data-theme="dark"] #content-wrapper {
    background: #1a1a2e !important;
}

[data-theme="dark"] #topbar {
    background: #16213e !important;
    border-bottom: 1px solid #2a2a4a;
}

[data-theme="dark"] .topbar-title {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .topbar-theme-toggle {
    background: #2a2a4a !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] #main-content {
    background: #1a1a2e !important;
}

[data-theme="dark"] .sidebar-toggle {
    color: #e2e8f0 !important;
}

/* Ensure body background matches in dark mode */
[data-theme="dark"] body.sidebar-layout {
    background: #1a1a2e !important;
}