/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    font-size: 1.75rem;
    -webkit-text-fill-color: var(--primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 2rem;
    width: calc(100% - 260px);
}

.content-wrapper {
    width: 100%;
    max-width: 850px;
    display: flex;
    flex-direction: column;
    transition: max-width 0.3s ease;
    margin: 0 auto;
}

#exchange-list-view .content-wrapper,
#finalized-view .content-wrapper {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    #exchange-list-view .content-wrapper,
    #finalized-view .content-wrapper {
        max-width: 100%;
        overflow-x: hidden;
    }
}

#new-exchange-view .content-wrapper {
    margin: 0 auto;
}

/* Headers */
header {
    margin-bottom: 2.5rem;
    text-align: left;
}

/* Mobile Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    width: 45px;
    height: 45px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 1.25rem;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

/* Responsive Rules */
@media (max-width: 768px) {
    .sidebar {
        left: -260px;
        z-index: 999;
        /* Fica acima de tudo, exceto do botão de fechar */
        background: var(--sidebar-bg);
        /* Garante fundo sólido */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 0 1.5rem 1.5rem 1.5rem;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        top: 1.25rem; /* Voltando para a posição original no topo */
        left: 1.25rem;
        z-index: 1001;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.sidebar-active .mobile-menu-toggle {
        left: 275px; /* Posiciona o botão à direita da sidebar aberta (260px + gap) */
    }

    .sticky-header {
        margin: 0 -1.5rem 2rem -1.5rem;
        padding: 1.5rem;
        top: 0;
        border-radius: 0;
        background: var(--bg-dark);
        border-bottom: 1px solid var(--glass-border);
        text-align: center;
        backdrop-filter: none !important; /* Remove o embaçado no mobile */
        -webkit-backdrop-filter: none !important;
    }

    .sticky-header header {
        margin-bottom: 1rem;
        text-align: center;
    }

    .header-top-row {
        flex-direction: column;
        align-items: center; /* Alinhado com o texto centralizado */
        gap: 1.5rem;
    }

    .header-actions {
        width: 100%;
        max-width: none;
        display: flex;
        gap: 0.75rem;
        justify-content: center;
    }

    .search-wrapper {
        flex: 1;
        max-width: 500px;
    }
}

.sticky-header {
    position: sticky;
    z-index: 100;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    margin: -2rem -2rem 2.5rem -2rem;
    padding: 1.25rem 2rem;
    transition: all 0.3s ease;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.header-titles h1 {
    font-size: 1.75rem !important;
    margin-bottom: 0 !important;
}

.header-titles p {
    font-size: 0.85rem !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    justify-content: flex-end;
    max-width: 800px;
}

.header-actions .search-container {
    margin-top: 0;
    flex-grow: 1;
    max-width: 500px;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}